Oncology
675 West 10th Ave, Floor 4
Vancouver B.C.
V5Z 1L3
Canada
-Original Message-
From: [EMAIL PROTECTED] on behalf of Yun Zhang
Sent: Fri 2/23/2007 7:34 AM
To: Henrique Dallazuanna
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to plot two graphs on one single plot
-
From: [EMAIL PROTECTED] on behalf
of Yun Zhang
Sent: Fri 2/23/2007 7:34 AM
To: Henrique Dallazuanna
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to plot two graphs on one
single plot?
Thanks. Now R plots two graphs on one plot.
Yet they are still on two graphs, vertically
parallelized
Hi,
I am trying to plot two distribution graph on one plot. But I dont know
how. I set them to the same x, y limit, even same x, y labels.
Code:
x1=rnorm(25, mean=0, sd=1)
y1=dnorm(x1, mean=0, sd=1)
x2=rnorm(25, mean=0, sd=1)
y2=dnorm(x2, mean=0, sd=1)
plot(x1, y1, type='p',
par(mfrow=c(2,1))
#your plot
#after plot
par(mfrow=c(1,1))
On 23/02/07, Yun Zhang [EMAIL PROTECTED] wrote:
Hi,
I am trying to plot two distribution graph on one plot. But I dont know
how. I set them to the same x, y limit, even same x, y labels.
Code:
x1=rnorm(25, mean=0, sd=1)
Thanks. Now R plots two graphs on one plot.
Yet they are still on two graphs, vertically parallelized with each other.
But what I want to do is actually plotting two distribution on one
single graph, using the same x and y axis. Like:
|
|
| (dist2)
| (dist 1)
|
Hum, ok, i don't was understanding, you can try:
plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x',
ylab='y')
lines(x2, d2, type='p', col='red')
Or perhaps
?curve
On 23/02/07, Yun Zhang [EMAIL PROTECTED] wrote:
Thanks. Now R plots two graphs on one plot.
Yet they are
Hi Yun,
If you're asking how to place new graphic material on the same plot
(e.g., several lines/points/etc in a single x-y region), this is
covered in the Intro to R manual. E.g., you can do:
plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2),
xlab='x', ylab='y')
points(x2, y2,
?par
try par(new=TRUE) between plots
Clint BowmanINTERNET: [EMAIL PROTECTED]
Air Dispersion Modeler INTERNET: [EMAIL PROTECTED]
Air Quality Program VOICE: (360) 407-6815
Department of Ecology FAX:(360) 407-7534
Thanks, it works. Thank you very much.
Yun
Matthew Keller wrote:
Hi Yun,
If you're asking how to place new graphic material on the same plot
(e.g., several lines/points/etc in a single x-y region), this is
covered in the Intro to R manual. E.g., you can do:
plot(x1, y1, type='p',
] How to plot two graphs on one single plot?
Thanks. Now R plots two graphs on one plot.
Yet they are still on two graphs, vertically parallelized with each other.
But what I want to do is actually plotting two distribution on one
single graph, using the same x and y axis. Like
10 matches
Mail list logo