[R] overplots - fixing scientific vs normal notation in output

Greg Snow Greg.Snow at intermountainmail.org
Fri Jun 8 17:33:32 CEST 2007


Peter Lercher wrote:

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Peter Lercher
> Sent: Friday, June 08, 2007 3:07 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] overplots - fixing scientific vs normal notation 
> in output
> 
> Moving from S-plus to R I encountered many great features and 
> a much more stable system.
> Currently, I am left with 2 problems that are handled differently:
> 
> 1) I did lots of "overplots" in S-Plus using
> par(new=T,xaxs='d',yaxs='d') to fix the axes
> ->What is the workaround in R ?

Since you are using the same axes, do you really need to do the
overplotting instead of just using lines/points to add to the plot?

R has not implemented xaxs='d', so on your additional plots, just
specify xlim and/or ylim directly.  There are a couple of ways to do
this.  First, find the range of values from all of your plots then use
this as the argument to xlim and ylim for each plot.  Second, create the
first plot then use par('usr') to find what the limits of the
coordinates are, then use these values for xlim/ylim in further plots
(using xaxs/yaxs='i' so the extra 4% is not added). Third, there are
probably other ways, but the above should get you started.



 
> 2) In S-Plus I could fix "scientific notation" or "normal 
> notation" in output
> ->How can I handle this in R ?
> I found no fix in the documentation

Look at options('scipen'), this is not exactly fixing it like S-PLUS,
but could solve most your problems.

> 
> I am using R version 2.4.1 (2006-12-18) on Windows XP SR2
> 
> 
> Peter Lercher, M.D., M.P.H., Assoc Prof
> 


Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111



More information about the R-help mailing list