Re: [R] multiple lines on multiple plots

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 12 Apr 2011 12:25:48 -0400

Instead of trying to go back to a previous plot, gather up all the data for the plots and generate each one with the appropriate data. This is much easier than trying to keep track of what the dimensions are. Also if the data you want to add is outside the plot, then you have issues with clipping; knowing what the dimensions of all the data you want to plot is a reasonable way to go.

On Tue, Apr 12, 2011 at 9:30 AM, James Annan <jdannan_at_jamstec.go.jp> wrote:
> I'm sure this must be trivial, but I'm a novice with R and can't work out
> how to handle the axes when I am constructing multiple plots on a page and
> try to return to a previous one to put multiple data sets it.
>
> A simple example:
> ---
> x<- 1:10
> y<- (1:100)*3
> par(mfcol=c(2,1))
> plot(x)
> plot(y)
>
> par(mfg=c(1,1))
> lines(x)
> ---
>
> The first 5 lines make two plots with a row of dots along the diagonal of
> each. I intended the last two statements to add a line to the first plot,
> that runs along the same data points already plotted there. However,
> although the commands add a line to the top plot, it is clearly using the
> axis dimensions of the lower plot. Can someone tell me how to get it to use
> the axes that are already there?
>
> Variants like lines(x,xlim=c(1,10)) have no effect.
>
> Thanks in advance for any help.
>
> James
> --
> James D Annan jdannan_at_jamstec.go.jp Tel: +81-45-778-5618 (Fax 5707)
> Senior Scientist, Research Institute for Global Change, JAMSTEC
> (The Institute formerly known as Frontier)
> Yokohama Institute for Earth Sciences, 3173-25 Showamachi,
> Kanazawa-ku, Yokohama City, Kanagawa, 236-0001 Japan
> http://www.jamstec.go.jp/frcgc/research/d5/jdannan/
>
> ______________________________________________
> 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.
>

-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

______________________________________________
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.
Received on Tue 12 Apr 2011 - 16:29:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Apr 2011 - 05:20:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive