2014-09-18 46 views
0

openair的windRose似乎沒有使用常用的par命令佈局。在這種情況下,我如何將windrose插入圖的右中間?在傳統圖形中插入windRose {openair} R

非常感謝!

感謝馬特

例如:

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))) 
+0

'windRose'是基於'lattice'包。 – 2014-09-19 01:41:48

回答

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

+0

,看起來可能是一個解決方案 - 我不熟悉xyplot。我需要在另一個數據系列的點之間添加一系列線。我保存的數據非常簡單。我會看看我怎麼走。謝謝! – user2449710 2014-09-19 04:12:40

+0

好吧,如果你嘗試混合基礎圖形和網格圖形,你不會有很多樂趣。所以,如果你想使用'windRose',我會建議使用'lattice'來處理其他的事情,但是如果你想使用base,你應該找到一個替代'windRose'的基礎(儘管我不確定存在這樣的事情 - 你必須自己做)。 – MrFlick 2014-09-19 04:14:20

+0

顯然有一個相當於線的網格(我稱之爲llines(我只需要解決,如果我可以添加llines語句到您的建議代碼,添加其他功能。我已經嘗試過,但沒有真正的成功 - 但沒有錯誤,如果我得到它,我會發布它 – user2449710 2014-09-19 06:11:59