Re: [R] Looking for parallel functionality between Matlab and R

From: Stephen Tucker <brown_emu_at_yahoo.com>
Date: Wed, 27 Jun 2007 04:54:43 -0700 (PDT)


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)

> 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?

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. Received on Wed 27 Jun 2007 - 12:03:58 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 27 Jun 2007 - 13:32:25 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.