madr
2010-Nov-22 10:04 UTC
[R] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()
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. -- 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-tp3053356p3053356.html Sent from the R help mailing list archive at Nabble.com.
madr
2010-Nov-22 10:13 UTC
[R] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()
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.
Ivan Calandra
2010-Nov-22 10:15 UTC
[R] xlim=c(min(x), max(x)) still produces extra margin on both sides of x axis in plot()
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
Possibly Parallel Threads
- "negative alpha" or custom gradient colors of data dots in scatterplot ?
- Drop in performance
- Xen 4.1-unstable VGA Passthrough Kernel Panic
- Xen 4.1-unstable VGA Passthrough Kernel Panic
- Troubleshooting underidentification issues in structural equation modelling (SEM)