I am looking for a function (or package) to plot histograms of directional data such as wind direction. I believe these are called rose diagrams. Is there an R script for this? If not, can it be constructed in a function calling primitive graphic calls (lines, circles, boxes or polygons)? The stars function is not quite right. -- David Finlayson Geomorphogist and GIS Specialist NearPRISM - Nearshore Research Group University of Washington, Seattle, WA (206) 543-7229 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 22 Nov 2001, David Finlayson wrote:> I am looking for a function (or package) to plot histograms of directional > data such as wind direction. I believe these are called rose diagrams. Is > there an R script for this?I don't believe so (help.search() and searching Jonathan Baron's page at finzi.psych.upenn.edu).> If not, can it be constructed in a function > calling primitive graphic calls (lines, circles, boxes or polygons)?Well, the answer to this is "yes" ...> The stars function is not quite right.If you can specify what's wrong with it (i.e., specifications for what a rose plot should look like, as opposed to what stars() already does) maybe someone can help you change it. The easiest thing may be to modify the stars function to do what you want, or figure out how to pre-process your data (e.g., inserting zero categories) so that stars() does do what you want. stars() is written in R rather than being a .Internal function, which simplifies things. Ben Bolker> > -- > David Finlayson > Geomorphogist and GIS Specialist > NearPRISM - Nearshore Research Group > University of Washington, Seattle, WA > (206) 543-7229 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hello David, i wrote a small function (rose) for that problem. It accept datas between 0 and 360 and draw something like you want. You also can rose <- function(data,step=30,main='wind rose'){ deg2rad <- 180/pi data <- (data+step/2)%%360# Values like 359 go to Sector 0 histdata <- hist(data,breaks=seq(0,360,by=step),plot=F) #use hist for counting counts <- histdata$counts maxcount <- max(counts) mids <- (histdata$mids-step/2)/deg2rad step <- step/deg2rad plot(c(-1,1),c(-1,1),,xlab='',ylab='', main=main,xaxt='n',yaxt='n',pch=' ') for (i in 1:length(counts)){ w1 <- mids[i]-step/2 w2 <- mids[i]+step/2 lines(counts[i]/maxcount*c(0,sin(w1),sin(w2),0), counts[i]/maxcount*c(0,cos(w1),cos(w2),0))#draw sector text(sin(mids[i]),cos(mids[i]),counts[i]) } names(counts) <- round(mids*deg2rad,3) counts } #Test with 500 values between 0 and 360 (uniform distribution) rose(runif(500)*360,360/16) David Finlayson wrote:> > I am looking for a function (or package) to plot histograms of directional > data such as wind direction. I believe these are called rose diagrams. Is > there an R script for this? If not, can it be constructed in a function > calling primitive graphic calls (lines, circles, boxes or polygons)? > > The stars function is not quite right. > > -- > David Finlayson > Geomorphogist and GIS Specialist > NearPRISM - Nearshore Research Group > University of Washington, Seattle, WA > (206) 543-7229 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Joerg Maeder IACETH INSTITUTE PhD Student FOR ATMOSPHERIC Phone: +41 1 633 36 25 AND CLIMATE SCIENCE Fax: +41 1 633 10 58 ETH Z?RICH Switzerland -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._