[R] Adding points on top of lines in xyplot

Gabor Grothendieck ggrothendieck at gmail.com
Tue Nov 20 20:26:48 CET 2007


Try this:

xyplot(y ~ Hour, xlab = list("Hour", font=2, cex=2), ylab= list("U_x * V",
font=2, cex=2), type = 'l', scales = list( x= list(tick.number=5, cex=2,
limits=c(0,4.5)), y=list(cex=0)), lines=TRUE, lwd = 2)

trellis.focus("panel", 1, 1, highlight = FALSE)
print(panel.points(Hour, y, pch = 16, cex = 3, col = "red"))
trellis.unfocus()


On Nov 20, 2007 2:14 PM, David Afshartous <dafshartous at med.miami.edu> wrote:
>
> All,
>
> I'm trying to make a basic plot: data points superimposed upon the a line
> connecting the points w/ a different color.  Example below doesn't work as
> the first xyplot call doesn't remain.  Suggestions?
>
> David
>
>
> Hour = c(NA,1,2,3,4)
> y = c(2,2,3,2,1.5)
>
> xyplot(y ~ Hour, xlab = list("Hour", font=2, cex=2), ylab= list("U_x * V",
> font=2, cex=2), type = 'l', scales = list( x= list(tick.number=5, cex=2,
> limits=c(0,4.5)), y=list(cex=0)), lines=TRUE, lwd = 2 , add=TRUE    )
>
>
> xyplot(y ~ Hour, xlab= "", ylab="", pch= 16, col=  "red", cex=3 , xlim =
> c(0, 4.5), add=TRUE    )
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list