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

2010-11-22 Thread madr

i found solution myself:

par(xaxs = i, yaxs = i) - it sets axis ranges to actual data ranges

sorry for question but maybe this will be easier to find if someone would be
searching for this
-- 
View this message in context: 
http://r.789695.n4.nabble.com/xlim-c-min-x-max-x-still-produces-extra-margin-on-both-sides-of-x-axis-in-plot-tp3053356p3053365.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2010-11-22 Thread Ivan Calandra

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.calan...@uni-hamburg.de

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.