[R] Reset par(xaxp) in plot

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Aug 20 16:42:42 CEST 2002



"Yang, Richard" wrote:
> 
> 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

With par("xaxp") you read the current status of the plot, you cannot set
it.
Use par("lab") for these purposes (only approx. number of intervals can
be given) or add the axis explicitly with axis(), e.g.:

  par("lab" = c(10,5,5))
  plot(...)

or better for your case:

  plot(..., xaxt = "n")
  axis(1, at = seq(0, 150, 15))

 
>         I use current version Lattice and Grid.

But not in the example above.

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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