[R] Y error bars, dates on the X-axis
Terhukka
terhi at live.co.uk
Fri Jun 3 17:41:02 CEST 2011
Dear forum,
Does anyone know any functions for plotting vertical error bars, if the
x-axis variable is a date?
I can produce a pretty plot with dates on the x-axis, if I don't want to
include error bars. I can also produce a nice plot with error bars, if I
just use Julian days for the x-axis, but I'd much rather have the actual
dates.
I have tried writing my own function, plotCI {gplots} and errbar {Hmisc}.
This is my own version:
y.error.bars<-function(x,y,ybar){plot(x,y,pch=16,ylim=c(min(y-ybar),max(y+ybar)))
arrows(x,y-ybar,x,y+ybar,code=3,angle=90,length=0.1)}
y.error.bars(x,y,yb)
It works if x is numeric, but once change the x variable to be a date, I get
the following error message:
"Error in arrows(x, y - ybar, x, y + ybar, code = 3, angle = 90, length =
0.1) :
invalid first argument"
Thanks!
--
View this message in context: http://r.789695.n4.nabble.com/Y-error-bars-dates-on-the-X-axis-tp3571219p3571219.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list