Fixing plot scale of windRose of R package

1.6k views Asked by At

I would appreciate your help.

I am using the function windRose of the openair package for R. I am doing wind roses for wind date from many stations, and I need to compare the results from all roses together. The problem is that the windRose function fixes the maximum radius of the windrose to a little bit more than the maximum % of counts found in any direction. How can I control the maximum scale of the windrose, lets say putting a fixed maximum of 30% for the max plotting radius instead of the default maximum put by the function and which depends on my data? I have explored the code of the function but I have not been able to locate the position in the windRose function code where I could do this change.

2

There are 2 answers

0
Justin On

Not exactly an answer to your question, but...

My ggplot2 windrose code where rose is a data.frame with columns of wind_speed and wind_direction in degrees:

rose <- data.frame(wind_speed=sample(1:25, 1e5, replace=TRUE), 
                   wind_direction=sample(1:360, 1e5, replace=TRUE))

ggplot(rose, 
       aes(x=wind_direction,
           fill=cut(wind_speed, seq(0, 30, 5)))) +
    geom_bar() +
    scale_x_continuous(limits=c(0,360),
                       breaks=c(0, 90, 180, 270)) +
    coord_polar() +
    labs(fill='Wind Speed (m/s)') +
    opts(axis.text.y=theme_blank(),
         axis.ticks=theme_blank(),
         axis.title.y=theme_blank(),
         axis.title.x=theme_blank())
0
Andy Clifton On

I coded up something here that would help. You can set the axis limits to whatever you need.