# [R] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()

Ivan Calandra ivan.calandra at uni-hamburg.de
Mon Nov 22 11:15:38 CET 2010

```Hi!

After plotting, take a look at par()\$usr; it gives you the coordinates
of the plotting region.
You could use it that way:
abline(v=c(par()\$usr[1], par()\$usr[2])...)

Note that you can also use it like this: par("usr")[1]

HTH,
Ivan

Le 11/22/2010 11:04, madr a écrit :
> code:
> op<-
> par(bg='black',fg='gray',col='gray',col.axis='gray',col.lab='gray',col.main='gray',col.sub='gray',mai=c(0,0,0,0),
> tck = 0.01, mgp = c(0, -1.4, 0), mar=c(0,0,0,0))
> plot(x,y,ylim=c(-20,20),xlim=c(min(x),max(x)),pch='X',col = rgb(1,1,1,
> 0.5),yaxt="n", ann=FALSE)
> abline(v=c(min(x),max(x)), lty=3, col="yellow")
> par<- op
>
> render:
> http://i51.tinypic.com/2rz9w0h.png
>
> So what I mean is the area between yellow lines and edges of the plotting
> area, so min(x) and max(x) would be really on the edge of the plot.

--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php

```