[R] overlay 2 dot plots

Bert Gunter gunter.berton at gene.com
Fri Jun 21 22:37:46 CEST 2013

dotplot is a lattice function. "add" is an argument to some base
graphics. Never the twain shall meet. There is no "add" argument to
dotplot -- did you read the lattice Help for dotplot (found under

I don't understand what you mean by "overlay" dotplots, but lattice
does this via conditioning variables or groups, depending on what you
have in mind.

In any case, it appears to me that you need to first read a tutorial
or book on lattice/trellis graphics before proceeding. Or find someone
local who can help you: afaics, you do not have a clue about how
lattice/trellis graphics works. It's far more than (I) can or should
be communicated on r-help.

Feel free to demonstrate publicly that **I** don't have a clue if I
have misunderstood or misjudged.


On Fri, Jun 21, 2013 at 12:43 PM, Andras Farkas <motyocska at yahoo.com> wrote:
> Dear All,
> wonder if you would provide your insights on the following: the code:
> library(lattice)
> y <-c(1:58)
> x <-runif(58,5,10)
> z <-runif(58,8,12)
> dataset <-data.frame(y,x)
> dotplot(y ~ x, data = dataset)
> dataset <-data.frame(y,z)
> dotplot(y~z,data = dataset,col="red")
> I would like to overlay the two plots, but no success so far, I tryed the add=TRUE command, but does not seem to work with this plot...
> appreciate the insights,
> Andras
> ______________________________________________
> 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.


Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374

More information about the R-help mailing list