I am trying to build some height data (usually between -90 and 90 degrees) and I managed to use coord_polar . Take a look at this code:
library(ggplot2) # r = c(2:8)*20 e = c(-4:9)*10 a = c(0:71)*5 points = expand.grid(r,e,a) colnames(points) = c("distance", "elevation", "azimuth") points$elevation[points$elevation <0] = points$elevation + 360 forEle = subset(points, azimuth == 0) #ele_range = ggplot(forEle, aes( x=elevation, y=distance))+ geom_point()+ coord_polar(theta = "x", start = -1.5708, direction = -1)+ scale_y_continuous(breaks = c(0:16)*10, limits=c(0, 160)) + scale_x_continuous(breaks=seq(0, 359, by=30), labels=c(expression(0^degree), expression(30^degree), expression(60^degree), expression(90^degree), expression(60^degree), expression(30^degree), expression(0^degree), expression(-30^degree), expression(-60^degree), expression(-90^degree), expression(-60^degree), expression(-30^degree)), limits=c(0, 360)) + labs(title = "", x = "x", y = "y")+ theme(legend.position="bottom")
My first difficulty was to display negative angles in the plot (I did this by adding 360 degrees to all negative values), but I wonder if there is a better way to do this. Secondly, and, more importantly, I would like to fix (or limit) the output from -90 to 90 degrees, i.e. On the right side of the graph, but I could not do it. Any help on this is welcome.