On 10/02/2011 07:20 PM, Hofert Jan Marius wrote:
Dear all,
this should be trivial, but I couldn't figure out how to solve it... I would like to have
a plot with fixed aspect ratio of 1. Whenever I resize the Quartz window, the axes are
extended so that the plot fills the whole window. However, if you have different
extensions for the different axes, the plot does not look like "a square"
anymore (i.e., aspect ratio 1). The same of course happens if you print it to .pdf
(ultimate goal). How can I fix the plot box (formed by the axes) ratio to be 1, meaning
that the plot box is a square no matter how I resize the Quartz window?
I searched for this and found:
http://tolstoy.newcastle.edu.au/R/help/05/04/2888.html
It is more or less recommended to use lattice's xyplot for that. Is there no
solution for base graphics?
[I know that the extension is by default 4% and that's great, but the the size
of the Quartz window should not change this (which it does if you resize the
window accordingly)].
Cheers,
Marius
Minimal example:
u<- runif(10)
pdf(width=5, height=5)
plot(u, u, asp=1, xlim=c(0,1), ylim=c(0,1), main="My title")
dev.off()
Hi Marius,
Have you tried:
par(pty="s")
after you open the device and before plotting?
Jim
______________________________________________
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.