El-ad David Amir
2007-Jun-26 12:20 UTC
[R] Looking for parallel functionality between Matlab and R
I'm slowly moving my statistical analysis from Matlab to R, and find myself missing two features: a) How do I mimic Matlab's 'hold on'? (I want to show several plots together, when I type two plots one after the other the second overwrites the first) b) How do I mimic Matlab's 'axis'? (after drawing my plots I want to zoom on specific parts- for example, x=0:5, y=0:20). Thanks for any assistance. [[alternative HTML version deleted]]
Christophe Pallier
2007-Jun-26 14:59 UTC
[R] Looking for parallel functionality between Matlab and R
On 6/26/07, El-ad David Amir <amel@cs.bgu.ac.il> wrote:> > a) How do I mimic Matlab's 'hold on'? (I want to show several plots > together, when I type two plots one after the other the second overwrites > the first)par(new=T) (see ?par) Yet, it often better, after a call to the 'plot' command, to use 'points' or 'lines' to add new elements to the plot. Also, if you want to plot several curves in one shoot, you can use 'matplot'. -- Christophe Pallier (http://www.pallier.org) [[alternative HTML version deleted]]
Greg Snow
2007-Jun-26 16:01 UTC
[R] Looking for parallel functionality between Matlab and R
For a), if you really want the plots overlayed, it is best to use something like matplot, or use the points or lines function to add the later plots to the first. You can also get the overlay effect using par(new=TRUE), but then you need to be careful with axis labels and scales and the plot may end up being more confusing then helpful. For b), if you are just doing a quick exploration of the plot, there is the zoomplot function in the TeachingDemos package that may work for you. If you want a plot to print/save, it is best to specify xlim and ylim in the initial plotting function to create it at the correct size/zoom from the beginning. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of El-ad > David Amir > Sent: Tuesday, June 26, 2007 6:21 AM > To: r-help at stat.math.ethz.ch > Subject: [R] Looking for parallel functionality between Matlab and R > > I'm slowly moving my statistical analysis from Matlab to R, > and find myself missing two features: > > a) How do I mimic Matlab's 'hold on'? (I want to show several > plots together, when I type two plots one after the other the > second overwrites the first) > b) How do I mimic Matlab's 'axis'? (after drawing my plots I > want to zoom on specific parts- for example, x=0:5, y=0:20). > > Thanks for any assistance. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, reproducible code. >
I think it has been pointed out but look at ?points and ?lines and ?par and have a look a the following link http://mathesaurus.sourceforge.net/octave-r.html good luck. A. ----- Original Message ----- From: "El-ad David Amir" <amel at cs.bgu.ac.il> To: <r-help at stat.math.ethz.ch> Sent: Tuesday, June 26, 2007 8:20 AM Subject: [R] Looking for parallel functionality between Matlab and R> I'm slowly moving my statistical analysis from Matlab to R, and find > myself > missing two features: > > a) How do I mimic Matlab's 'hold on'? (I want to show several plots > together, when I type two plots one after the other the second overwrites > the first) > b) How do I mimic Matlab's 'axis'? (after drawing my plots I want to zoom > on > specific parts- for example, x=0:5, y=0:20). > > Thanks for any assistance. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, reproducible code.
Jim Lemon
2007-Jun-27 11:05 UTC
[R] Looking for parallel functionality between Matlab and R
El-ad David Amir wrote:> I'm slowly moving my statistical analysis from Matlab to R, and find myself > missing two features: > > a) How do I mimic Matlab's 'hold on'? (I want to show several plots > together, when I type two plots one after the other the second overwrites > the first) > b) How do I mimic Matlab's 'axis'? (after drawing my plots I want to zoom on > specific parts- for example, x=0:5, y=0:20). >I think what you want for a) is par(ask=TRUE). There have been a few discussions of zooming on the help list - see: http://stats.math.uni-augsburg.de/iPlots/index.shtml for one solution. Jim