Would it be possible to change the axis at the end?
My data sets seem to be quite large so I was thinking for the plot and the 
consequent lines to keep always 
the current minimum and maximum like
 
plot(x)
minimum=min(x)
lines(x1)
minimum=c(minimum,x1)
lines(x2)minimum=c(minimum,x2)
then if there is a good way for altering axis lines I could put the limits I 
want to.
 
Regards
Alex
 

________________________________
 From: Jim Lemon <j...@bitwrit.com.au>
To: 

Sent: Tuesday, March 20, 2012 10:07 AM
Subject: Re: [R] Automaticall adjust axis scales
  
Alaios wrote:
> Dear all,
>
> I have made a function that given a number of list elements plot them to the 
> same window.
>
> The first element is plotted by using plot and all the rest are plotted under 
> the
>
> same window by using lines.
>
> I have below a small and simple reproducible example.
>
>
> x1<-c(1:10)
> plot(x1)
>
> x2<-c(11:20)
> lines(x2)
>
> x3<-c(31:40)
> lines(x3)
>
>
>
>
> as you might notice
> the two consecutive lines fail to be plotted as the axis were formed by the 
> first plot.
> Would it be possible after the last lines to change the axis to the minimum 
> and the maximum of all data sets to be visible?
>
> Any idea how I can do that?
>
>
Hi Alaois,
Try this:

ylim=range(c(x1,x2,x3))
plot(x1,ylim=ylim,type="l")
lines(x2)
lines(x3)

Jim
        [[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.

Reply via email to