[R] Adding points on top of lines in xyplot

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Nov 20 20:40:13 CET 2007


On 11/20/07, Dylan Beaudette <debeaudette at ucdavis.edu> wrote:
> On Tuesday 20 November 2007, Deepayan Sarkar wrote:
> > On Nov 20, 2007 11:14 AM, 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?
> >
> > xyplot(y ~ Hour, type = 'b', lwd = 2, pch= 16, col.symbol =  "red", cex=3)
> >
> > or for finer control
> >
> > xyplot(y ~ Hour,
> >        panel = function(x, y, ...) {
> >            panel.lines(x, y, lwd = 2)
> >            panel.points(x, y, pch = 16, cex = 3, col = "red")
> >        })
> >
> > -Deepayan
> >
>
> Deepayan,
>
> is there any way to do something similar, but when the data used to plot the
> lines and the points come from different dataframes and a grouping variable
> is used?

There's a way to do almost everything, but we need a reproducible
example (preferably minimal) and a clear statement of what you want to
do to help.

-Deepayan



More information about the R-help mailing list