控制ylim标签,其中scale = free in xyplot lattice

时间:2016-01-13 18:24:20

标签: r lattice

当我将scale参数设置为y轴的free时,我试图控制xyplot中的y轴标签。我想我已经能够为每个面板设置ylim,但是无法弄清楚如何为y轴设置标签。现在有些面板有2个标签,有些面板有最大y lim值的标签。我希望所有面板都能保持一致。

数据:

 dput(datan.1)
structure(list(Cruise = c(201501L, 201501L, 201502L, 201503L, 
201501L, 201501L, 201502L, 201502L, 201503L, 201503L, 201503L, 
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201503L, 
201503L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201501L, 
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201501L, 
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 
201501L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 
201503L, 201503L, 201501L, 201501L, 201502L, 201502L, 201502L, 
201503L, 201503L, 201501L, 201501L), SAMS_region = structure(c(2L, 
3L, 3L, 5L, 1L, 5L, 2L, 5L, 1L, 3L, 5L, 2L, 3L, 5L, 2L, 3L, 5L, 
3L, 5L, 1L, 2L, 3L, 5L, 1L, 2L, 3L, 5L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 
4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 5L, 
2L, 3L, 4L, 1L, 2L, 4L, 5L), .Label = c("DMV", "ET", "HC", "HCsr", 
"LI"), class = "factor"), Length = c(7.5, 7.5, 7.5, 7.5, 12.5, 
12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 17.5, 17.5, 17.5, 17.5, 17.5, 
17.5, 17.5, 17.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 
22.5, 22.5, 22.5, 22.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 
27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 32.5, 32.5, 32.5, 32.5, 
32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 
37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 
37.5, 37.5, 37.5, 37.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 
42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 47.5, 47.5, 47.5, 
47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 
47.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 
52.5, 52.5, 52.5, 52.5, 52.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 
57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 62.5, 62.5, 
62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 
62.5, 62.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 
67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 72.5, 72.5, 72.5, 72.5, 72.5, 
72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 77.5, 
77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 
77.5, 77.5, 77.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 
82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 87.5, 87.5, 87.5, 87.5, 
87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 
92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 
92.5, 92.5, 92.5, 92.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 
97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 102.5, 102.5, 
102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 
102.5, 102.5, 102.5, 102.5, 107.5, 107.5, 107.5, 107.5, 107.5, 
107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 
107.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 
112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 117.5, 117.5, 
117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 
117.5, 117.5, 117.5, 117.5, 122.5, 122.5, 122.5, 122.5, 122.5, 
122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 
122.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 
127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 132.5, 132.5, 
132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 
132.5, 132.5, 132.5, 132.5, 137.5, 137.5, 137.5, 137.5, 137.5, 
137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 
137.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 
142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 147.5, 147.5, 
147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 
147.5, 147.5, 147.5, 147.5, 152.5, 152.5, 152.5, 152.5, 152.5, 
152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 
152.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 
157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 162.5, 162.5, 
162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 
162.5, 167.5, 167.5, 167.5, 167.5, 167.5, 167.5, 167.5, 172.5, 
172.5), nwide = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 
0, 0, 0, 0, 0, 0, 0, 0, 1.5, 7.5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 
0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 25.75, 1, 0, 5, 0, 72.5, 
0, 0, 0, 0, 0, 4.1, 0, 0, 5, 74.5416666666667, 1.75, 0, 5, 0, 
203, 3, 0, 0, 0, 108.75, 0, 0, 0, 14, 439.916666666667, 20, 0, 
8.25, 1, 417.105, 6.5, 3.4, 0, 0, 387, 21.65, 0, 0, 48, 994.791666666667, 
39.75, 0, 2, 1, 1002.365, 24, 0, 4, 4.95, 790.2, 35.475, 0, 0, 
68.5, 1136.625, 38.25, 1.625, 1, 6, 1023.765, 60.25, 0, 14.3333333333333, 
7.95, 855.55, 65.6, 0, 1, 40.375, 939.791666666667, 45.0416666666667, 
4.25, 7, 4, 943.375, 32, 4.4, 16.2222222222222, 13.5, 826.9, 
54.125, 0, 2, 12, 296.208333333333, 30.875, 7.5, 21, 3, 527.125, 
56.05, 11.1, 54.7777777777778, 11.25, 467.45, 71.35, 3.2, 11.2, 
11.5, 197.833333333333, 47.575, 7.45, 31.32, 7.875, 269.083333333333, 
21.4, 19.8, 74.1111111111111, 16, 307.9, 33.225, 4.2, 19.4, 18.5, 
151.916666666667, 48.35, 17, 51.73, 10.84, 163.15, 24.9, 59.4, 
126.222222222222, 41.75, 118.75, 20.1, 12.2, 17.05, 18.5, 251.833333333333, 
107.1, 27.5, 36.54, 40.16, 134.5, 27.5, 125, 111.111111111111, 
77.665, 140.9, 8.51, 17.4, 22.15, 45.1, 629.875, 114.225, 37.2, 
40.76, 55.715, 359.79, 65.9, 168.9, 87, 108.365, 294.4, 10.01, 
24, 11.7, 57.9, 1496.45833333333, 141.925, 42.325, 34.26, 24.41, 
1078.49833333333, 140.45, 215, 53, 115.95, 322.845, 23.01, 30.2, 
21.9, 29.85, 2552.33333333333, 139.65, 36.375, 36.33, 53.045, 
1728.72, 174.25, 164.6, 57.1111111111111, 166.395, 776.07, 150.245, 
27.4, 30.3, 46.3, 2561.58333333333, 224.9, 34.3, 46.06, 89.36, 
2101.99666666667, 237.55, 82.2, 56.2333333333333, 204.72, 922.745, 
286.825, 24.2, 29.6, 202.355, 2898.625, 502.266666666667, 66.825, 
75.03, 349.955, 3399.87833333333, 411.95, 116.1, 138.566666666667, 
281.815, 1048.625, 626.795, 34.4, 84.05, 598.12, 4501.70833333333, 
1488.5, 131.25, 307.65, 1020.96, 5593.03166666667, 971.5, 102.9, 
316, 557.415, 1920.21, 1267.92, 80.8, 251.5, 857.17, 6830.79166666667, 
2442.38333333333, 173.325, 467.34, 1344.51, 8411.34, 1650.5, 
96.4, 552.844444444444, 1032.13, 3298.97, 1574.205, 102.2, 408.2, 
725.27, 8797.41666666667, 2349, 150.375, 565.95, 1290.39, 9944.14833333333, 
1595.05, 99.7, 626.011111111111, 1342.755, 7052.925, 1379.015, 
158, 471.9, 653.68, 9980.20833333333, 1508.2, 110.525, 559.06, 
798.92, 10267.5533333333, 1139.75, 110.2, 659.444444444444, 1461.34, 
9324.13, 1002.965, 151.6, 524.15, 541.295, 7769.45833333333, 
853.258333333333, 119, 497.31, 537.2, 8269.565, 843.65, 154.1, 
646.055555555556, 1239.855, 7746.945, 707.575, 123.6, 537, 286.69, 
4814.125, 490.85, 137.5, 418.13, 260.465, 4799.68333333333, 513.55, 
129.7, 469.833333333333, 659.66, 5212.63, 383.635, 86.6, 439.5, 
111.595, 1866.45833333333, 336.058333333333, 106.675, 308.08, 
108.65, 2345.025, 264.9, 107.4, 293.2, 307.32, 2464.3, 271.185, 
64.8, 282.35, 36.41, 522.5, 134.2, 69.825, 135.15, 50.6, 994.215, 
112.6, 88.7, 164.333333333333, 96.165, 1254.82, 192.475, 45.2, 
150.55, 9.99, 261.708333333333, 81.975, 52.2, 51.32, 18.5, 382.933333333333, 
65, 55.4, 77.8, 43.915, 362.13, 101.585, 22, 71.5, 0, 117.625, 
24.375, 19, 13.75, 7.75, 113.875, 30.5, 14.1, 20, 6.75, 89.095, 
38.23, 4, 25.35, 1.33, 38.75, 17.75, 8.2, 2, 4.5, 74.7333333333333, 
14.5, 9, 3, 13, 10, 13, 4, 4.2, 10, 2, 3, 1, 5.95, 11, 1, 2, 
7.5, 8, 2, 4, 2, 0, 18.85, 4.25, 1, 1, 6, 1, 1.25), nfine = c(4.75, 
1, 2.25, 1, 1, 5.2, 11, 3, 2, 5.8, 3.99, 11.5, 19.7, 2.2, 154, 
17, 8, 1, 20.97, 5.25, 128.75, 141.75, 7.8, 0, 775, 95, 20, 46.8, 
17.1, 5, 25.29, 17, 610.316666666667, 298.8, 3.2, 5.1, 1, 2529.97368421053, 
347.9, 2, 42, 184.55, 60.2, 25.5, 73.32, 99.25, 2489.3, 734.85, 
9.2, 16.2, 12.125, 5208.28070175439, 889.8, 1, 132, 16, 971.21, 
202.3, 15, 268.1, 437.25, 6749.47333333333, 2213.35, 78.9736842105263, 
31, 109, 12827.8605263158, 2692.25, 7.8, 406.3, 176, 3846.86, 
749.26, 14.8, 584.86, 1374, 14372.1883333333, 4299.1, 144, 48.6, 
399.5, 20266.4087719298, 5986.6, 18.6, 603.6, 753.985294117647, 
9845.53, 2507.6, 83.4, 611.5, 2698.25, 18320.49, 6132.2, 233.373684210526, 
108.6, 1253.5, 26216.85, 9642.65, 51.8, 764.25, 1971.71176470588, 
17300.03, 6959.34, 229.7, 508.67, 2513.25, 15144.1366666667, 
6179.05, 256.615789473684, 233.8, 1913.875, 23985.0385964912, 
10083.1, 112.6, 1104.95, 3112.51470588235, 20598.95, 10323.21, 
615.5, 1079.92, 1161.25, 8409.37166666667, 4277.35, 294.857894736842, 
424.3, 1504.25, 13951.7043859649, 7022.275, 191.2, 2590.4, 2533.06764705882, 
16143, 8043.1, 1112.5, 1999.34, 349, 2995.155, 2154.55, 342.294736842105, 
783.9, 487.375, 5515.91315789474, 4247.075, 200, 3911.15, 839.594117647059, 
7403.84, 4019.14, 1346.1, 2721.35, 107.25, 857.066666666667, 
1091.55, 329.094736842105, 958.6, 151.75, 1273.05175438596, 2521.35, 
285.2, 4145.35, 295.476470588235, 2354.6, 1741.46, 1392.4, 3844.68, 
80.25, 373.6, 570.35, 372.426315789474, 1081.3, 146.375, 558.766666666667, 
1189.475, 338.4, 3527.8, 336.582352941176, 591.91, 766.88, 980.7, 
3879, 124.25, 544.313333333333, 408.95, 405.7, 724.7, 289.875, 
761.837719298246, 798.475, 454, 2338.95, 622.164705882353, 693.87, 
322.14, 572.4, 1666.23, 154.75, 1433.98333333333, 472.65, 345.457894736842, 
422.6, 311.875, 1573.97035087719, 628.575, 583, 991.75, 922.711764705882, 
1605.68, 334.49, 342.1, 708.1, 189.75, 2955.78333333333, 483.1, 
241.642105263158, 239.1, 323.75, 2861.94377192982, 604.8, 492.2, 
558.95, 1054.97058823529, 3434.17, 349.56, 159.2, 419.37, 113.5, 
3496.37, 443.35, 115.494736842105, 147.5, 193.5, 3177.50157894737, 
819.8, 277.4, 382.4, 736.211764705882, 4659.87, 477.12, 121.4, 
198.95, 63, 2392.70666666667, 235.25, 67.8684210526316, 108.7, 
151.375, 2168.86649122807, 568.9, 100.8, 257.9, 194.908823529412, 
2618.79, 659.08, 88.6, 117.52, 97.25, 1167.39166666667, 247.45, 
42.8, 83.6, 225.125, 1871.22640350877, 351.175, 78.6, 242.5, 
194.385294117647, 919.31, 606.66, 52, 108.28, 142.75, 1279.59666666667, 
362.85, 63.2, 109.3, 305.25, 2546.84675438597, 529.525, 54.2, 
228, 456.8, 697.71, 840.01, 71.2, 144.91, 151, 1724.25166666667, 
524.1, 40.5736842105263, 123.5, 439.875, 3762.77736842105, 607.3, 
52.8, 214.1, 865.055882352941, 1122.59, 780.16, 42.4, 133.13, 
134.25, 2667.27166666667, 516.6, 52, 123.1, 459.75, 4279.19236842105, 
560.4, 43.6, 188.9, 675.567647058824, 1250.52, 610.56, 61, 163.07, 
100.75, 2569.38333333333, 314.95, 28.3473684210526, 137.2, 284.375, 
2968.87473684211, 316.35, 46.8, 225.55, 480.397058823529, 1283.47, 
385.08, 41.8, 175.94, 84, 1978.4, 241.55, 27.1473684210526, 144, 
140.375, 1972.64947368421, 253.3, 43, 186.15, 223.158823529412, 
907.82, 238.26, 26.8, 141.92, 48.5, 1359.06166666667, 113.8, 
22.9736842105263, 121.8, 45.5, 802.036052631579, 114.35, 48, 
171.1, 52.9, 540.7, 122.99, 28.4, 117.87, 23, 670.626666666667, 
46.2, 26.9736842105263, 89.7, 16.75, 320.805, 42.2, 23, 103.35, 
18.45, 191, 63.36, 14, 79.66, 11.5, 192.466666666667, 29.05, 
23.9736842105263, 51.5, 11, 72.08, 22.2, 22, 57.65, 4.8, 80.3, 
47.41, 11.8, 56.36, 3, 117.99, 20.3, 4, 16.1, 1, 32.9, 8.2, 18.8, 
21.4, 1, 20.95, 11.86, 5, 11, 2, 30.53, 12, 3, 5, 2.625, 12.1, 
10.7, 11, 14.75, 0, 3.8, 8.66, 1, 3, 1, 23.555, 6, 2, 4, 0, 5.9, 
3.2, 3, 1.75, 0, 0, 4, 0, 1, 37.6666666666667, 2, 0, 0, 7.2, 
0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0)), .Names = c("Cruise", 
"SAMS_region", "Length", "nwide", "nfine"), row.names = c(83L, 
142L, 424L, 792L, 25L, 252L, 365L, 530L, 584L, 689L, 793L, 84L, 
143L, 253L, 334L, 425L, 531L, 690L, 794L, 26L, 85L, 144L, 254L, 
283L, 335L, 426L, 532L, 636L, 691L, 741L, 795L, 27L, 54L, 145L, 
197L, 255L, 308L, 336L, 427L, 478L, 533L, 637L, 692L, 742L, 796L, 
28L, 55L, 115L, 198L, 224L, 309L, 337L, 428L, 479L, 534L, 585L, 
638L, 663L, 743L, 797L, 1L, 56L, 116L, 199L, 225L, 310L, 338L, 
397L, 480L, 535L, 586L, 609L, 694L, 744L, 798L, 2L, 57L, 117L, 
200L, 226L, 284L, 339L, 398L, 454L, 536L, 587L, 610L, 664L, 745L, 
799L, 3L, 58L, 118L, 201L, 227L, 285L, 340L, 399L, 482L, 506L, 
560L, 611L, 665L, 746L, 800L, 4L, 59L, 119L, 173L, 228L, 286L, 
341L, 400L, 483L, 507L, 561L, 612L, 666L, 747L, 769L, 5L, 60L, 
120L, 174L, 229L, 287L, 342L, 401L, 455L, 508L, 562L, 613L, 667L, 
748L, 770L, 6L, 61L, 121L, 175L, 230L, 288L, 343L, 402L, 456L, 
509L, 563L, 614L, 668L, 720L, 771L, 7L, 62L, 122L, 176L, 231L, 
289L, 344L, 403L, 457L, 510L, 564L, 615L, 669L, 721L, 772L, 8L, 
63L, 123L, 177L, 232L, 290L, 345L, 404L, 458L, 511L, 565L, 616L, 
670L, 722L, 773L, 9L, 64L, 124L, 178L, 233L, 291L, 346L, 405L, 
459L, 512L, 566L, 617L, 671L, 723L, 774L, 10L, 65L, 125L, 179L, 
234L, 292L, 347L, 406L, 460L, 513L, 567L, 618L, 672L, 724L, 775L, 
11L, 66L, 126L, 180L, 235L, 293L, 348L, 407L, 461L, 514L, 568L, 
619L, 673L, 725L, 776L, 12L, 67L, 127L, 181L, 236L, 294L, 349L, 
408L, 462L, 515L, 569L, 620L, 674L, 726L, 777L, 13L, 68L, 128L, 
182L, 237L, 295L, 350L, 409L, 463L, 516L, 570L, 621L, 675L, 727L, 
778L, 14L, 69L, 129L, 183L, 238L, 296L, 351L, 410L, 464L, 517L, 
571L, 622L, 676L, 728L, 779L, 15L, 70L, 130L, 184L, 239L, 297L, 
352L, 411L, 465L, 518L, 572L, 623L, 677L, 729L, 780L, 16L, 71L, 
131L, 185L, 240L, 298L, 353L, 412L, 466L, 519L, 573L, 624L, 678L, 
730L, 781L, 17L, 72L, 132L, 186L, 241L, 299L, 354L, 413L, 467L, 
520L, 574L, 625L, 679L, 731L, 782L, 18L, 73L, 133L, 187L, 242L, 
300L, 355L, 414L, 468L, 521L, 575L, 626L, 680L, 732L, 783L, 19L, 
74L, 134L, 188L, 243L, 301L, 356L, 415L, 469L, 522L, 576L, 627L, 
681L, 733L, 784L, 20L, 75L, 135L, 189L, 244L, 302L, 357L, 416L, 
470L, 523L, 577L, 628L, 682L, 734L, 785L, 21L, 76L, 136L, 190L, 
245L, 303L, 358L, 417L, 471L, 524L, 578L, 629L, 683L, 735L, 786L, 
22L, 77L, 137L, 191L, 246L, 304L, 359L, 418L, 472L, 525L, 579L, 
630L, 684L, 736L, 787L, 23L, 78L, 138L, 192L, 247L, 305L, 360L, 
419L, 473L, 526L, 580L, 631L, 685L, 737L, 788L, 52L, 79L, 139L, 
193L, 248L, 306L, 361L, 420L, 474L, 527L, 581L, 632L, 686L, 738L, 
789L, 24L, 80L, 140L, 194L, 249L, 307L, 362L, 421L, 475L, 528L, 
582L, 633L, 687L, 739L, 790L, 81L, 141L, 195L, 250L, 363L, 422L, 
476L, 529L, 634L, 688L, 740L, 791L, 82L, 282L, 364L, 423L, 477L, 
583L, 635L, 196L, 251L), class = "data.frame")

绘制代码

xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1,
    scales=list(y=list(relation="free")),
    key=list(space="bottom",lines=list(col=c("red","blue")),text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8),    
    ylab=list("Number",cex=.8),xlab=list("Length (mm)",cex=.8),
    strip = strip.custom(bg="white",strip.levels = T),
    prepanel=function(x,y,subscripts,...){
    list(ylim=c(0,max(y)))
    },
    panel=function(x,y,subscripts, ...){
    panel.xyplot(x,y,type="l",col="blue")
    panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l")
    },as.table=T,subscripts=T)

R会话信息

 sessionInfo ()
R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] datasets  utils     stats     graphics  grDevices methods  
[7] base     

other attached packages:
 [1] plotrix_3.5-12      reshape2_1.4.1      reshape_0.8.5      
 [4] qpcR_1.4-0          Matrix_1.2-1        robustbase_0.92-5  
 [7] rgl_0.95.1435       minpack.lm_1.2-0    lmtest_0.9-34      
[10] zoo_1.7-12          dplyr_0.4.2         plyr_1.8.3         
[13] MASS_7.3-40         RODBC_1.3-12        latticeExtra_0.6-26
[16] RColorBrewer_1.1-2  lattice_0.20-31    

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6     magrittr_1.5    R6_2.1.0       
 [4] stringr_1.0.0   tools_3.2.1     parallel_3.2.1 
 [7] grid_3.2.1      DBI_0.3.1       lazyeval_0.1.10
[10] assertthat_0.1  stringi_0.5-5   DEoptimR_1.0-4 

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

我不清楚你想要什么“一致”。标签数量取决于数据范围。打印的标签数量取决于间距。如果您调整图形设备的大小,您可能会看到打印不同的标签。

如果将标签旋转到水平,您可能会获得所有刻度线的标签,这在某种意义上更加一致。同样,取决于图形设备的大小。使用rot=c(0,90)alternating=FALSE

xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1, scales=list(y=list(relation="free"),rot=c(0,90),alternating=FALSE), key=list(space="bottom",lines=list(col=c("red","blue")),text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8), ylab=list("Number",cex=.8),xlab=list("Length (mm)",cex=.8), strip = strip.custom(bg="white",strip.levels = T), # prepanel=function(x,y,subscripts,...){ # list(ylim=c(0,max(y))) # }, panel=function(x,y,subscripts, ...){ panel.xyplot(x,y,type="l",col="blue") panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l") },as.table=T,subscripts=T)

请注意,似乎没有必要使用预付费功能。

修改

按照“格子图书”中的示例获取固定数量的y轴刻度。

axis.CF <- function(side, ...) {
 if (side == "left") { 
 ylim <- current.panel.limits()$ylim
 top=round(ylim[2],-2)+100
 panel.axis(side = side, outside = TRUE,text.cex=.7, at = 0:4*top/4) 
} 
else axis.default(side = side, ...)
 }

xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1,
    scales=list(y=list(relation="free"),rot=c(0,90),alternating=FALSE), 
   key=list(space="bottom",lines=list(col=c("red","blue")),text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8),
   ylab=list("Number",cex=.8),xlab=list("Length (mm)",cex=.8),
    strip = strip.custom(bg="white",strip.levels = T),axis=axis.CF,
 #    prepanel=function(x,y,subscripts,...){
 #   list(ylim=c(0,max(y)+100))
 #    },
    panel=function(x,y,subscripts, ...){
    panel.xyplot(x,y,type="l",col="blue")
    panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l")
    },
as.table=T,subscripts=T)