# [R] windrose color ramp issue

MacQueen, Don macqueen1 at llnl.gov
Thu Dec 15 01:50:14 CET 2011

```There is also a windrose (though not with that name) function in the
openair package.
-Don

--
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062

On 12/12/11 1: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","yel
>lowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumo
>rchid","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="geographic
>s",ticks=FALSE,osize=0.05,cir.ind
>=0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=T
>RUE,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!
>
>
>--
>State Climate Office of North Carolina
>Department of Marine, Earth and Atmospheric Sciences
>North Carolina State University
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help