3

I am trying to create a half polar coordinates figure plot in R using ggplot2, somewhat similar to http://www.mathworks.com/matlabcentral/fileexchange/27230-half-polar-coordinates-figure-plot-function-halfpolar in MATLAB.

The values in my dataset range from -90 to 90 degrees, and I would like the half polar plot to range from -90 to 90 degrees.

I have tried to create a "full" polar plot, followed by cropping the image. However, I would then have to reorient every single label, since my desired range is on the bottom half of the plot.

Code I used to get the full polar plot:

ggplot(dataset, aes(x=V1))+ 
    geom_histogram(binwidth=5, origin=-2.5, colour="blue", size=0.25)+
    coord_polar()+
    scale_x_continuous(limits=c(-180,180), breaks=seq(-180,180, by=10),
                 minor_breaks=seq(-180,180, by=2.5))  

Here is a mock dataset created by runif:

V1 <- c(-11.3438825588673,2.51569095999002, 7.56844081915915,20.0369969941676,22.4103817017749,32.2332751471549, 47.9410658357665,-15.8775348449126,-7.69269382581115,9.54788790550083, 27.5170193053782,5.08095151744783,-7.74303053040057,24.6316244825721, -41.1148839630187,-17.9084718693048,-34.4687476754189,48.4857349423692, -14.2394224880263,-0.372639088891447)
dataset <- data.frame(V1)

Any help would be much appreciated!

MSJ
  • 178
  • 1
  • 7

0 Answers0