From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>

Date: Wed 13 Jul 2005 - 18:12:42 EST

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 13 18:27:56 2005

Date: Wed 13 Jul 2005 - 18:12:42 EST

On 13-Jul-05 klebyn wrote:

> Hello,

*>
**> How to use the function plot to produce graphs as Matlab?
**> example in Matlab:
**>
**> a = [1,2,5,3,6,8,1,7];
**> b = [1,7,2,9,2,3,4,5];
**> plot(a,'b')
**> hold
**> plot(b,'r')
**>
**>
**> How to make the same in R-package ?
**>
**> I am trying something thus:
**>
**> a <- c(1,2,5,3,6,8,1,7)
**> c(1,7,2,9,2,3,4,5) -> b
**>
**> a;b
**>
**> plot(a,t="l",col="blue")
**> plot(b,t="l",col="red")
*

plot(a,t="l",col="blue",ylim=c(0,10))

lines(b,t="l",col="red")

octave:1> x = 0.1*(0:20);

octave:2> plot(x,sin(x))

produces a graph of sin(x) with the y-axis scaled from 0 to 1.0 Next:

octave:3> hold on

octave:4> plot(x,1.5*cos(x))

superimposes a graph of 1.5*cos(x) with the y-axis automatically re-scaled from -1 to 1.5.

This would not have happened in R with

x = 0.1*(0:20);

plot(x,sin(x))

lines(x,1.5*cos(x))

x = 0.1*(0:20);

plot(x,sin(x),ylim=c(-1,1.5))

lines(x,1.5*cos(x))

Indeed, R will not allow you to use "xlim" or "ylim" once the first plot has been drawn.

Is it feasible to include, as a parameter to "plot", "lines" and "points",

where this default value would maintain the existing behaviour of these functions, while setting

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861

Date: 13-Jul-05 Time: 09:12:34 ------------------------------ XFMail ------------------------------ ______________________________________________R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 13 18:27:56 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:33:37 EST
*