[R] Looking for parallel functionality between Matlab and R

Stephen Tucker brown_emu at yahoo.com
Wed Jun 27 13:54:43 CEST 2007


This zooming function on the R-Wiki page was very neat:

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:interactive_zooming

Also, to answer question (a), maybe these examples might help?

## add elements to plot
plot(1:10,1:10)
lines(1:10,(1:10)/2)
points(1:10,(1:10)/1.5)

## add second y-axis
par(mar=c(5,4,2,4)+0.1)
plot(1:10,1:10)
par(new=TRUE)
plot(-20:20,20:-20,col=4,
     type="l",axes=FALSE,
     xlab="",ylab="",
     xaxs="i",
     xlim=par("usr")[1:2])
axis(4,col=4,col.axis=4)
mtext("second y-axis label",4,outer=TRUE,padj=-2,col=4)






--- Jim Lemon <jim at bitwrit.com.au> wrote:

> 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
> 
> ______________________________________________
> 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.
> 



      ____________________________________________________________________________________
Luggage? GPS? Comic books?



More information about the R-help mailing list