0

I have been trying for quite some time to create error bars in a polar plot using plotrix. While the scatter function were no issue, I was unable to add the error bars, because when I add for example the lines with a second polar plot with radian mode, I cannot move them away from the center of the plot to start at the scatter point... my best guess was to add a second polar plot on top, with a radian of the scatterplot point + the error bars, and then add a white line on top of that, with scatterplot point - error bars, covering up the error bar up to the lower limit... This is obviously not only very ugly in code, but also in the graph, so I was wondering, whether there is a better solution for that. My code so far (using mtcars as a nonsensical example) looks like this:

 library(plotrix)

polar.plot(mtcars$mpg, polar.pos=NULL, start=90,clockwise=TRUE,rp.type="s", 
    point.symbols=19, point.col="black",show.grid=TRUE, show.radial.grid=FALSE,
    show.grid.labels=TRUE,boxed.radial=FALSE, radial.lim=c(0,40))

polar.plot(mtcars$mpg+mtcars$gear, polar.pos=NULL, start=90,clockwise=TRUE,
    rp.type="r", point.symbols=16,show.grid.labels=TRUE,boxed.radial=FALSE, 
    radial.lim=c(0,40), add=TRUE, lwd=3)

polar.plot(mtcars$mpg-mtcars$gear, polar.pos=NULL, start=90,clockwise=TRUE,
     rp.type="r", point.symbols=16,show.grid.labels=TRUE,boxed.radial=FALSE,
     radial.lim=c(0,40), add=TRUE, lwd=4, line.col="white")

enter image description here

MrFlick
  • 195,160
  • 17
  • 277
  • 295
Carsten
  • 23
  • 3
  • So what specifically do you want to change in the graph that makes it "ugly"? – MrFlick Nov 26 '14 at 16:20
  • Particularly the fact, that the white bar also covers up the gridlines from the graph, which is particularly annoying when using radial gridlines as well... If creating the gridlines on top instead to prevent that, they then again cover up the symbols and error bars! – Carsten Nov 26 '14 at 18:02

0 Answers0