Skip to content

overlay 2 dot plots

6 messages · Andras Farkas, Bert Gunter, David L Carlson +2 more

#
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
#
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
xyplot)??

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.

Cheers,
Bert
On Fri, Jun 21, 2013 at 12:43 PM, Andras Farkas <motyocska at yahoo.com> wrote:

  
    
#
Maybe something like this?

dataset <- data.frame(x=c(y, y), y=c(x, z), g=rep(1:2, each=58))
dotplot(x~y, groups=g, data=dataset)

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Andras Farkas
Sent: Friday, June 21, 2013 2:43 PM
To: r-help at r-project.org
Subject: [R] overlay 2 dot plots

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.
#
In a similiar manner with additions
  dat <- data.frame(x=x,y=y,z=z)
dotplot(y~z+x,data = dat, pch = 16, type= c("p","g"))

  HTH

Duncan


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au
At 07:00 22/06/2013, you wrote:
#
Bert,

you did judge all right, indeed, I do not have a clue about how lattice/trellis graphics works. With regards to "Feel free to demonstrate publicly that **I** don't have a clue if I have misunderstood or misjudged", thank you, but I will pass on that... I do not feel it is important for me to publicly demonstrate the fact that someone does not know as much about the area of **my** primary interest as **I** do, instead, I would rather teach them... There are others that do a great job at this kind of "public demonstration":-).

by overlaying this is what I meant:

library(lattice)
y <-c(1:58)
x <-runif(58,5,10)
z <-runif(58,8,12)
dataset <-data.frame(y,x,z)

dotplot(y ~ c(x,z), data = dataset,col=c("blue","red"))

thanks for the help,

Cheers,

Andras
--- On Fri, 6/21/13, Bert Gunter <gunter.berton at gene.com> wrote:

            
#
On Jun 22, 2013, at 8:22 AM, Andras Farkas wrote:

            
I think you should wait a bit before doing any more lattice demonstrations. That approach completely obscures the source of hte values from 'x' and 'z' groups. Using y ~ x+z would be much more informative (as advised by Duncan MacKay