在 R 中绘制风玫瑰?

Plot wind rose in R?

我有一个简单的频率和12扇区的平均风速。如何将此数据绘制为风向图(我不想使用 plot_ly)!

DF = structure(list(Sector = c("0-N", "1-NNE", "2-ENE", "3-E", "4-ESE", "5-SSE", 
                               "6-S", "7-SSW", "8-WSW", "9-W", "10-WNW", "11-NNW"), 
                    A_parameter = c(4.84, 5.04, 5.05, 4.7, 4.41, 4.66, 5.76, 
                                    7.44, 6.92, 4.87, 4.39, 4.13), 
                    k_Parameter = c(2.24, 2.271, 2.115, 1.959, 1.779, 1.943, 2.01,
                                    2.393, 2.326, 1.971, 1.908, 1.904), 
                    frequency = c(0.057, 0.08, 0.086, 0.071, 0.05, 0.041, 
                                  0.071, 0.178, 0.182, 0.089, 0.051, 0.045), 
                    mean_WS = c(4.287, 4.464, 4.473, 4.167, 3.924, 4.132, 5.104, 
                                6.595, 6.131, 4.317, 3.895, 3.665)), 
               .Names = c("Sector", "A_parameter", "k_Parameter", 
                          "frequency", "mean_WS"), 
               row.names = c("3", "4", "5", "6", "7", 
                             "8", "9", "10", "11", "12", "13", "14"), 
               class = "data.frame")

plot_ly 中会变成这样:

plot_ly(DF, r = ~(DF$frequency*DF$mean_WS), t = ~DF$Sector)%>% add_area()

这里我有什么选择?

这是一个 ggplot2 解决方案。我在风玫瑰条的顶部放置了网格线以匹配情节外观,但您可以将其关闭:

DF$Sector <- factor(DF$Sector, levels = DF$Sector)
ggplot(DF,
       aes(x = Sector, y = frequency * mean_WS)) +
  geom_col(width = 1, fill = "steelblue", color = "steelblue") +
  coord_polar(start = -pi/12) + # change start value if you want a different orientation
  theme_light() +
  theme(axis.title = element_blank(),
        panel.ontop = TRUE, # change to FALSE for grid lines below the wind rose
        panel.background = element_blank())