[R] Alignment of lines within barplot bars
snowboarder101
daniel.benjamin.frank at gmail.com
Fri Apr 8 22:25:30 CEST 2011
Thanks for the reply. I looked at this before as I saw you had posted this,
but this either doesn't work in my situation, or I am using it wrong.
Take the example in the function:
tmp <- barplot(1:4)
updateusr(tmp[1:2], 0:1, 1:2, 0:1)
lines(1:4, c(1,3,2,2), lwd=3, type='b',col='red')
But I want to use par(new=T) and plot(), so:
tmp <- barplot(1:4)
par(new=T)
updateusr(tmp[1:2], 0:1, 1:2, 0:1)
plot(1:4, c(1,3,2,2), lwd=3, type='b',col='red')
The reason I do this is that the y-axis then corresponds to my plot() data.
In my specific case, it's more like this:
tmp <- barplot(c(1.5,40),yaxt='n',names.arg=1:2,ylim=c(0,1.25*40))
axis(4)
par(new=T)
updateusr(tmp[1:2], 1:2)
plot(1:2,c(0.01,0.02),xaxt='n',pch=16)
I want those points in the middle of the bars... but I want to keep the
y-axis labels from the second plot. the par(new=T) probably wipes out the
coordinates, so I'm not sure how use this?
Thanks Again.
--
View this message in context: http://r.789695.n4.nabble.com/Alignment-of-lines-within-barplot-bars-tp2533115p3437369.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list