[R] Alignment of lines within barplot bars

snowboarder101 daniel.benjamin.frank at gmail.com
Thu Apr 7 20:38:00 CEST 2011


I am dealing with a similar issue, I am trying to use a barplot in
conjunction with some points plotted and want to line the two up. This all
works fine, but I am dealing with the additional complication that I have
two y-ranges. The barplot is based on one range, while the points are based
on another. The way I have been dealing with this is to use barplot(), and
then use a par(new=T), and then do the plot. So I have axis(2) with the
points, and axis(4) with the barplot values. However, the points don't line
up. When I do it the other way and do barplot(), points() with the barplot()
x coordinates, the range isn't correct, and not all points appear. 

I can force barplot() to use my range of points, but then the bars are too
small. I can also try to normalize my points to be in the same range as the
barplot() data, but then I have issues labeling it appropriately. That is,
my axis(2) is incorrect, and I need this whole thing to function dynamically
in a function, so I can't explicitly list the labels.

Any thoughts on this would be appreciated. 

View this message in context: http://r.789695.n4.nabble.com/Alignment-of-lines-within-barplot-bars-tp2533115p3434209.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list