[R] windrose color ramp issue
Adrienne Wootten
amwootte at ncsu.edu
Tue Dec 13 18:12:40 CET 2011
An update on this particular problem I've been having. It seems that
the number of pedals (the bins argument of the windrose command) is
somehow effecting the number of colors that will be plotted. This
makes no sense since it only controls the number of pedals in the
windrose not the number of colors.
A
On Mon, Dec 12, 2011 at 4:20 PM, Adrienne Wootten <amwootte at ncsu.edu> wrote:
> Greetings!
>
> I'm having an issue with the windrose produced by the windrose
> function from the circular package. For our weather stations in North
> Carolina I'm helping with a script which takes hourly wind speed and
> direction data to create windroses for our end users. One of the
> stations in the mountains frequently reaches wind speed of 40 to 60
> mph and in storms can reach wind speed over 80 mph. This has brought
> up an issue with the color ramp.
>
> Currently the color ramp works one of two ways:
>
> #1) Holding the pedal colors fixed:
>
> incrspeeds = 2 # fills out the increments argument
> pedalcolors = c("darkblue","blue","royalblue","darkturquoise","forestgreen","green","yellowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumorchid","purple")
>
> #or 2) Making the pedal colors dynamic based on the increments and the
> max wind speed.
>
> incrspeeds = 2 # fills out the increments argument
>
> breaks=seq(0,round(maxwind),incrspeeds) # maxwind is the maximum wind speed
> numcolors=length(breaks)
>
> if(numcolors>length(pedalcolors)){
> pedalcolors=rev(rainbow(numcolors))
> }
>
> # In either case the result ends up in the wind rose function
>
> rose=windrose(wr,breaks=NULL,bins=numpedals,increment=incrspeeds,main=NULL,fill.col=pedalcolors,plot.mids=FALSE,units="degrees",template="geographics",ticks=FALSE,osize=0.05,cir.ind
> =0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=TRUE,calm=c("0"),number.calm=TRUE)
>
> The issue when there are really large wind speeds in the first case,
> the windrose wraps the color ramp twice in both the legend and the
> windrose itself, and then gives only white for the remaining bands of
> each pedal. For the second case, when pedalcolors will have the same
> number of colors as numcolors, the legend has the right color ramp,
> but the pedals of the windrose don't have all the colors that are
> passed to it. Say pedalcolors has 40 colors, which are included in
> the legend, but the windrose only includes the first 16 colors in
> pedalcolors.
>
> Any thoughts as to why this might be happening in either case? Thanks!
>
> Adrienne
>
> --
> Adrienne Wootten
> Graduate Research Assistant
> State Climate Office of North Carolina
> Department of Marine, Earth and Atmospheric Sciences
> North Carolina State University
--
Adrienne Wootten
Graduate Research Assistant
State Climate Office of North Carolina
Department of Marine, Earth and Atmospheric Sciences
North Carolina State University
More information about the R-help
mailing list