Patrick Jemison
2011-Jun-27 22:35 UTC
[R] Creating a Polar Plot with expanding points as radius increases
I'd like to create a polar plot similar to those created by the polarFreq function in the openair package. However, this package seems to be specific to wind speed and direction, and requires a "ws" (wind speed) and a "wd" (wind direction) column. My data is unrelated to wind speed, but I'd like to be able to get a plot that does what polarFreq's plots do; I'd like to have points that expand as their distance from the center increases. http://www.oga-lab.net/RGM2/func.php?rd_id=openair:polarFreq Without this property, my plot looks more like spokes on a wheel, or similar to the polar.plot function in the plotrix package: http://www.oga-lab.net/RGM2/func.php?rd_id=plotrix:polar.plot Is there a package or function available that allows the creation of a plot as described above for a generic set of polar data? I spent a few hours today trying to find something I could use, but no luck yet. I'm using data of the form: x = r, y = theta, and z = a value to plot at the corresponding r,theta (as a comparison, for the polarFreq plot, z would be the frequency that is indicated by various colors in the plot). I appreciate any help! Patrick Jemison
Greg Snow
2011-Jun-28 00:53 UTC
[R] Creating a Polar Plot with expanding points as radius increases
I would look at the ggplot2 package, I have seen examples using ggplot2 that look similar to what you describe. -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Patrick Jemison Sent: Monday, June 27, 2011 4:36 PM To: r-help at stat.math.ethz.ch Subject: [R] Creating a Polar Plot with expanding points as radius increases I'd like to create a polar plot similar to those created by the polarFreq function in the openair package. However, this package seems to be specific to wind speed and direction, and requires a "ws" (wind speed) and a "wd" (wind direction) column. My data is unrelated to wind speed, but I'd like to be able to get a plot that does what polarFreq's plots do; I'd like to have points that expand as their distance from the center increases. http://www.oga-lab.net/RGM2/func.php?rd_id=openair:polarFreq Without this property, my plot looks more like spokes on a wheel, or similar to the polar.plot function in the plotrix package: http://www.oga-lab.net/RGM2/func.php?rd_id=plotrix:polar.plot Is there a package or function available that allows the creation of a plot as described above for a generic set of polar data? I spent a few hours today trying to find something I could use, but no luck yet. I'm using data of the form: x = r, y = theta, and z = a value to plot at the corresponding r,theta (as a comparison, for the polarFreq plot, z would be the frequency that is indicated by various colors in the plot). I appreciate any help! Patrick Jemison ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
baptiste auguie
2011-Jun-28 01:09 UTC
[R] Creating a Polar Plot with expanding points as radius increases
Try this, library(ggplot2) d <- data.frame(theta = runif(10, 0, 360), r = runif(10, 0, 3)) ggplot(d, aes(x=theta, y=r, size=r)) + coord_polar(start=0)+ geom_point() + scale_x_continuous(breaks=seq(0, 360, by=30), expand=c(0,0), lim=c(0, 360))+ scale_area() HTH, baptiste On 28 June 2011 10:35, Patrick Jemison <jemison at gmail.com> wrote:> I'd like to create a polar plot similar to those created by the polarFreq > function in the openair package. ?However, this package seems to be specific > to wind speed and direction, and requires a "ws" (wind speed) and a "wd" > (wind direction) column. ?My data is unrelated to wind speed, but I'd like > to be able to get a plot that does what polarFreq's plots do; I'd like to > have points that expand as their distance from the center increases. > > http://www.oga-lab.net/RGM2/func.php?rd_id=openair:polarFreq > > Without this property, my plot looks more like spokes on a wheel, or similar > to the polar.plot function in the plotrix package: > http://www.oga-lab.net/RGM2/func.php?rd_id=plotrix:polar.plot > > Is there a package or function available that allows the creation of a plot > as described above for a generic set of polar data? ?I spent a few hours > today trying to find something I could use, but no luck yet. > > I'm using data of the form: x = r, y = theta, and z = a value to plot at the > corresponding r,theta (as a comparison, for the polarFreq plot, z would be > the frequency that is indicated by various colors in the plot). > > I appreciate any help! > > Patrick Jemison > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Jim Lemon
2011-Jun-28 11:29 UTC
[R] Creating a Polar Plot with expanding points as radius increases
On 06/28/2011 08:35 AM, Patrick Jemison wrote:> I'd like to create a polar plot similar to those created by the polarFreq > function in the openair package. However, this package seems to be specific > to wind speed and direction, and requires a "ws" (wind speed) and a "wd" > (wind direction) column. My data is unrelated to wind speed, but I'd like > to be able to get a plot that does what polarFreq's plots do; I'd like to > have points that expand as their distance from the center increases. > > http://www.oga-lab.net/RGM2/func.php?rd_id=openair:polarFreq > > Without this property, my plot looks more like spokes on a wheel, or similar > to the polar.plot function in the plotrix package: > http://www.oga-lab.net/RGM2/func.php?rd_id=plotrix:polar.plot > > Is there a package or function available that allows the creation of a plot > as described above for a generic set of polar data? I spent a few hours > today trying to find something I could use, but no luck yet. > > I'm using data of the form: x = r, y = theta, and z = a value to plot at the > corresponding r,theta (as a comparison, for the polarFreq plot, z would be > the frequency that is indicated by various colors in the plot). >Hi Patrick, polar.plot (or other plots in the radial.plot family) currently don't plot sectors or fill the (what the heck is the intersection of a sector and an annulus called?) to illustrate a third value (say, proportion) in addition to direction and intensity. However, it can be done, and I might just have a shot at it if I can scratch up an hour or two sometime in the next couple of years. Well, maybe sooner than that. Look out for "radial.pie". Jim