在传统图R中插入windRose {openair}

时间:2014-09-18 21:32:17

标签: r layout graph

来自露天场所的windRose似乎没有使用par命令的通常布局。在这种情况下,我如何将windrose插入图表的中间右侧?

非常感谢!

谢谢马特

示例:

ggg <- structure(list(x = c(1686.29539249942, 1952.01119249943, 2400.93389249944, 
2602.40289249947, 2586.61109249949, 2592.65409249944, 2590.39889249945, 
2590.9353924994, 2611.7025924994, 2774.91209249943, 1125.22839249942
), y = c(2159.24498939552, 2051.76498939594, 2048.12498939916, 
1570.48498939818, 1511.80498939867, 1468.7849893975, 1428.74498939667, 
1385.66498939617, 1265.88498939688, 984.744989396288, 129.984989397419
)), .Names = c("x", "y"), row.names = c(NA, -11L), class = "data.frame")

plot(ggg[,1], ggg[,2])
require(openair)
wind.examp <- structure(list(wind.steps.nomissing.Direction = c(107.2, 102.4, 
119.9, 99.23, 113.5, 120.3, 102.7, 99.28, 98.29, 107.6, 107.6, 
103.6, 112.8, 102.1, 111.1, 117.9, 105.5, 98.8, 96.6, 99.56, 
96.12, 96.91, 94.64, 95.91, 94.85, 102.1, 103.5, 105.8, 101.7, 
103.4, 108.4, 116.8, 123.3, 115.7, 141.4, 93.58, 97.88, 110.3, 
108.1, 90.57, 97.19, 105.6, 89.81, 98.88, 99.29, 91.53, 106.5, 
100.2, 106, 109.1, 105.2, 112.1, 106.4, 106.9, 104.8, 107.2, 
106.5, 102.9, 102.9, 106.1, 110.3, 112.3, 114.4, 109.9, 107.7, 
104.3, 104, 98.4, 97.16, 95.48, 94.59, 94.15, 101.1, 105.9, 106.8, 
113.5, 114.4, 110.5, 106.4, 106.1, 104, 101.4, 103.7, 105.4, 
94.62, 93.25, 100.3, 96.26, 96.23, 91.69, 100.4, 99.2, 100, 90.2, 
87.5, 96.33, 96.94, 96.44, 88.3, 88.38), wind.steps.nomissing.Speed = c(2.449, 
2.913, 1.921, 2.732, 2.501, 2.04, 2.72, 2.375, 2.618, 2.24, 2.046, 
2.497, 2.121, 2.822, 2.322, 2.139, 2.511, 2.774, 2.532, 3.127, 
2.533, 2.422, 2.515, 2.454, 2.522, 2.795, 2.583, 2.327, 2.318, 
2.133, 1.631, 1.221, 0.9404, 1.331, 0.9874, 2.052, 2.657, 2.636, 
3.192, 3.93, 3.603, 2.834, 3.404, 2.937, 2.906, 3.34, 2.608, 
2.996, 2.509, 2.598, 2.859, 2.565, 3.231, 3.518, 3.729, 3.562, 
3.639, 3.573, 3.695, 3.588, 3.232, 2.925, 2.527, 2.522, 2.709, 
2.947, 3.079, 3.251, 2.766, 2.516, 2.59, 2.727, 2.182, 2.524, 
2.349, 2.03, 1.948, 2.142, 2.41, 2.184, 2.167, 3.264, 3.611, 
3.312, 3.372, 3.164, 2.689, 3.047, 2.87, 2.848, 2.83, 2.984, 
2.851, 3.441, 3.149, 2.591, 2.557, 2.454, 2.435, 2.211)), .Names =   
c("wind.steps.nomissing.Direction", 
"wind.steps.nomissing.Speed"), row.names = c(NA, 100L), class = "data.frame")

par(usr=c(500, 1500, 1200, 2000), new=TRUE)
windRose(wind.examp, ws="wind.steps.nomissing.Speed", wd="wind.steps.nomissing.Direction",     
angle=10,col=c("gray", "black", "blue", "red"),   
par.settings=list(fontsize=list(text=30)))

1 个答案:

答案 0 :(得分:1)

windRose不是基础图形功能,它建立在网格图形之上。它似乎也遵循许多lattice标准函数和参数。如何使用所有lattice函数

xy<-xyplot(y~x, ggg)
wr<-windRose(wind.examp, ws="wind.steps.nomissing.Speed", 
    wd="wind.steps.nomissing.Direction",     
    angle=10,col=c("gray", "black", "blue", "red"),   
    par.settings=list(fontsize=list(text=12)))

print(xy, more=TRUE)
print(wr, position=c(.1,.1,.7,.7))

产生

enter image description here