# [R] plot with the axes at xlim and ylim

Ko-Kang Kevin Wang Ko-Kang at xtra.co.nz
Tue Mar 19 12:42:12 CET 2002

```Not quite sure what exactly you want, but it seems like:
plot(c(1:9), c(1:9), xlim = xlim, ylim = ylim)
does the job - though I'm not sure why you specify ylim = c(0, 11) instead
of ylim = c(0,10).

Cheers,

Ko-Kang

------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
Auckland
New Zealand

----- Original Message -----
From: "Arnold Kester" <arnold.kester at stat.unimaas.nl>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Tuesday, March 19, 2002 10:55 PM
Subject: [R] plot with the axes at xlim and ylim

> I'd like to make a plot with the axes drawn at the values of xlim and
> ylim. The default plot draws the axes slightly outside these values. I
> have been experimenting with the par(mgp) setting, but specifying
> par(mgp=c(2,0,-1)) gives me
>
> "invalid value specified for graphics parameter "mgp".".
>
> A more complicated mathod that almost seems to work is doing the plot
> with "axes=F" and then adding the axes with "axis" statements:
>
> xlim <- c(0,10)
> ylim <- c(0,11)
> plot(c(1:9),c(1:9),axes=F,xlim=xlim,ylim=ylim)
> axis(1,pos=ylim[1])
> axis(2,pos=xlim[1])
> axis(3,pos=ylim[2],labels=F)
> axis(4,pos=xlim[2],labels=F)
>
> The problem here is that the vertical axes are not long enough.
>
> Is there an easier way to get what I want?
>
> Thanks,
> Arnold Kester
>
> --
> Met vriendelijke groet,
> Arnold Kester
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> 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
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>

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