[R] Second axis in a plot

Agustin Lobo alobo at paleo.ija.csic.es
Mon Jun 17 17:06:49 CEST 2002


Gregor Gawron had the same problem 6 days ago and got the following 
solution. You can find more useful messages to other similar
problems by looking at the archive.
(http://cran.r-project.org/search.html and
http://www.r-project.org/nocvs/mail/r-help/2002/summary.html)

Suerte.

Agus

###################################################
Date: Tue, 11 Jun 2002 06:48:38 -0700
From: Don MacQueen <macq at llnl.gov>
To: Gregor Gawron <gregor.gawron at rmf.ch>, r-help at stat.math.ethz.ch
Subject: Re: [R] Different y-axes

Here is an example:

x <- 1:5
y1 <- 1:5
y2 <- 25:21
plot(x,y1)
par(new=T)
plot(x,y2,yaxt='n',col='blue')
axis(4,y2)

-Don

At 12:40 PM +0200 6/11/02, Gregor Gawron wrote:
>Hi All,
>
>I have checked everything I could find abot graphics, but still cannot
>solve the problem.
>Are there any ways to make a graph that plots two lines and two
>different y-axes, each of them has a scale that is related to the
>respective line. For example, y1 has a range 1:50 and y1 ranges 0:1. The
>x-axe is the same for both.
>
>Thank you in advance.
>
>---
>Gregor Gawron
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


On Mon, 17 Jun 2002, [iso-8859-1] Juan Cuervo wrote:

> Hi to all,
> First of all, I prefer to tell that I am a R-newbie,
> so I apologize if this is a silly question (I have
> tried looking in the manuals, but without luck).
> I have two variables, y and z, that I want to plot
> against x in the same plot. I have done this before,
> using points() after plot(). But now the problem is
> that y and z are in different units of measurement,
> and their ranges are very different.
> I have tried drawing a second axis with axis(), but I
> found the same problem: the new axis is drawn in the
> same range than the first variable plotted in the
> y-axis.
> I would greatly appreciate some suggestions.
> Regards,
> Juan L. Cuervo
> 
> 
> _______________________________________________________________
> Copa del Mundo de la FIFA 2002
> El único lugar de Internet con vídeos de los 64 partidos. 
> ¡Apúntante ya! en http://fifaworldcup.yahoo.com/fc/es/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list