Re: [R] two curves at one graph

2008-05-19 Thread Jim Lemon

hanen wrote:

i try to use par(new=TRUE) i get them at the same graph but the y_axis and
x_axis are drowen with two unevenly graduations that graph become
unreadable.

Hi Hanen,
If you want to plot two sets of values that fit into the same range, 
plot the one with the larger range first, then use the "points" (or 
"lines") function to plot the other set. For example:


x1<-c(1.2,2.3,3.4,4.5)
# this one has a larger range
x2<-c(0.3,2.4,4.6,6.8)
# plot the one with the wider range
plot(x2,col="red")
# then the one that fits within the first range
points(x1,col="green")

If the ranges of the values overlap, but neither range fits in the other:

x1<-c(4.5,7.9,9.1,9.9)
x2<-c(0.3,2.4,4.6,6.8)
# use ylim to leave enough room on the first plot
plot(x2,ylim=range(c(x1,x2)),col="red")
points(x1,col="green")

If the ranges are really different, you can try gap.plot or twoord.plot 
in the plotrix package:


x1<-c(1.2,2.3,3.4,4.5)
x2<-c(20.3,22.4,34.6,46.8)
gap.plot(c(x1,x2),col=c(rep("green",4),rep("red",4)),gap=c(6,18))
# OR
twoord.plot(x1,x2)

In the above example, gap.plot is probably better for this data.

Jim

__
R-help@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.


Re: [R] two curves at one graph

2008-05-18 Thread jim holtman
plot(...)
par(new=TRUE)
plot(..., axes=FALSE, xlab='', ylab='')  # prevent redraw of the axis
axis(4)   # add secondary y-axis on the right.

On Sun, May 18, 2008 at 4:44 PM, hanen <[EMAIL PROTECTED]> wrote:

>
> i try to use par(new=TRUE) i get them at the same graph but the y_axis and
> x_axis are drowen with two unevenly graduations that graph become
> unreadable.
> --
> View this message in context:
> http://www.nabble.com/two-curves-at-one-graph-tp17307590p17307590.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] two curves at one graph

2008-05-18 Thread Rolf Turner

?lines
?points

On 19/05/2008, at 8:44 AM, hanen wrote:



i try to use par(new=TRUE) i get them at the same graph but the  
y_axis and

x_axis are drowen with two unevenly graduations that graph become
unreadable.
--
View this message in context: http://www.nabble.com/two-curves-at- 
one-graph-tp17307590p17307590.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@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.


[R] two curves at one graph

2008-05-18 Thread hanen

i try to use par(new=TRUE) i get them at the same graph but the y_axis and
x_axis are drowen with two unevenly graduations that graph become
unreadable.
-- 
View this message in context: 
http://www.nabble.com/two-curves-at-one-graph-tp17307590p17307590.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.