[R] Reset par(xaxp) in plot

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Aug 20 16:34:19 CEST 2002


"Yang, Richard" <dyang at nrcan.gc.ca> writes:

> R-Helpers;
> 
> 	This seems simple to set graphic parameter, but I tried plot a graph
> with 10 intervals in x axis with  par(xaxp = c(0, 150, 10) but to no avail:
> 
> 	par(xaxp =c (0, 150,  10))
> 	plot(age, y18, type="n", ylab="Height (m)", xlab=" age (Yrs)", font
> = 2)
> 	lines(age, y6, lty = 4, lwd = 2)
> 	lnes(age, y10, lty = 1, lwd =2)
> 	lines(age, y14, lty = 2, lwd =2)
> 	lines(age, y18, lty = 3, lwd = 2)
> 	abline(v=50)
> 
> The plot shown only 3 intervals with tick at 0, 50, 100, and 150. and 
> 
> > par()$xaxp
> [1]   0 150   3
...
> 	What did I miss?


xaxp is a bit tricky since it gets calculated and *set* by routines
like plot. You can, however, plot without axes, set xaxp, and then use
axis():

 plot(1:10,axes=F)
 par(xaxp=c(1,10,99))
 axis(1)
 axis(2)
 box()

(Arguably, plot(1:10,xaxp=c(1,10,99)) could be coerced to work, but it
currently does not.)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list