Hi everyone, Hi Hadley,
I am a heavy user of coord_equal() in ggplot2 since most of my data is spatial, on x,y coordinates. Everything works. However by enforcing an aspect ratio of 1 for the plotting region, coord_equal() usually wastes a lot of space if the region of interest is not a perfect square.
For example:
x=runif(10) a=data.frame(x=x*3,y=x) ggplot(data=a, aes(x=x,y=y)) + geom_point() + coord_equal()produces a square plotting region while all the data is constrained in an horizontally extended rectangle. I would expect the coordinates to stay equal but the plot to be extended so that it fills as much as the plotting region as possible. It does not appear to be currently doable. Is it a limitation of ggplot? of the underlying grids graphics? Is there a workaround this?
Thanks in advance for your help.
PS:
x=runif(10) qplot(x*3, x) + coord_equal()
foo=x qplot(foo*3, foo) + coord_equal()
PPS: I tried
ggplot(data=a, aes(x=x,y=y)) + geom_point() + coord_equal() +
scale_y_continuous(limits=c(0,1))
which has no effect. but the side effect of enforcing the square
domain is that:
ggplot(data=a, aes(x=x,y=y)) + geom_point() + coord_equal() +
scale_y_continuous(limits=c(0,0.3))
has no effect either (i would expect to see only the points <0.3)
JiHO
--- http://jo.irisson.free.fr/ ______________________________________________ R-help_at_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.Received on Fri 11 Jan 2008 - 00:20:03 GMT
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jan 2008 - 03:30:06 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.