[R] xyplot question
Raymond Balise
iteachtyping at gmail.com
Sat Sep 15 00:37:38 CEST 2007
I am tring to do an xyplot where I want to plot 5 dots in each pane of
the trellice and the dots need to have lines (whiskers) extending up
and down at each point(plus a 45 degree reference line). The data
frame is set up with the variables x y lcl and ucl (where the lcl and
ucl are the limits on the lines I want). The code below gives me the
points but I cant figure out the lines limited by the lcl and ucl
variable.
library(lattice)
library(grid)
with(fig2,
xyplot(y ~ x | group * Method,
xlab = "",
xlim = c(-5, 1),
ylab = "",
ylim = c(-5, 1),
col = "black",
groups = group,
aspect = 1,
panel = function(x, y, ...) {
panel.superpose(x, y, ...)
panel.abline(0, 1)
},
)
)
The not trellice version of the first image I need in the xyplot can
be done like this:
with(sub1,
plot(y~x,
xlim = c(-5,1),
ylim = c(-5,1)
)
)
abline (0, 1)
lines(rep(sub1$x[1],2), c(sub1$lcl[1], sub1$ucl[5]))
lines(rep(sub1$x[2],2), c(sub1$lcl[2], sub1$ucl[5]))
lines(rep(sub1$x[3],2), c(sub1$lcl[3], sub1$ucl[5]))
lines(rep(sub1$x[4],2), c(sub1$lcl[4], sub1$ucl[5]))
lines(rep(sub1$x[5],2), c(sub1$lcl[5], sub1$ucl[5]))
How can i tell it to use the lcl and ucl values to draw the whiskers I
need above and below the points?
More information about the R-help
mailing list