相关疑难解决方法(0)

如何在ggplot2中用lat lon和箭头绘制风向

我有一个数据帧与Lat Lon mean_windwind_dir 在每个网格单元.我试图用背景和风向上的平均风作为每个网格单元格上的箭头制作空间图.

我试过跟踪样本数据框架 wind.dt

win.plt<- ggplot(wind.dt,aes(x=Lon,y=Lat))+
           #Mean wind plot : OK
        geom_tile(aes(fill=mean_wind),alpha=1)+
        geom_tile(aes(color=mean_wind), fill=NA) +
        scale_fill_gradientn(colours=(brewer.pal(9,rev("RdYlGn"))))+ 
        scale_color_gradientn(colours=(brewer.pal(9,rev("RdYlGn"))),guide=F)
          #Wind Direction : doesnot work
        geom_segment(arrow = arrow(),aes(yend = Lon + wind_dir, xend = Lat + wind_dir))

win.plt

wind.dt<-structure(list(Lon = c(170.25, 171, 171.75, 172.5, 173.25, 174, 
174.75, 175.5, 176.25, 177, 177.75, 178.5, 179.25, 180, 180.75, 
181.5, 182.25, 183, 183.75, 184.5, 185.25, 186, 186.75, 187.5, 
188.25, 189, 189.75, 190.5, 191.25, 192, 192.75, 193.5, 194.25, 
170.25, 171, 171.75, 172.5, 173.25, …
Run Code Online (Sandbox Code Playgroud)

plot r ggplot2

16
推荐指数
1
解决办法
1308
查看次数

标签 统计

ggplot2 ×1

plot ×1

r ×1