To provide a specific aspect ratio, for example. for the square, use theme(aspect.ratio=1) .
Andri's answer does not give a complete picture, since the example gives possibly unnatural data, where the range x is equal to the range y. If, however, the data were:
df <- data.frame( x = runif(100, 0, 50), y = runif(100, 0, 5)) ggplot(df, aes(x=x, y=y)) + geom_point() + coord_fixed()
then the graph will look like this:

The Coord_fixed () function also has an argument to adjust the axis relationship:
ratio expressed as y / x
So that the graph can be made square with:
ggplot(df, aes(x=x, y=y)) + geom_point() + coord_fixed(ratio=10)

But you need to configure this with the limitations of variables or chart areas (not all limits are well divided by integers like these examples).
a different ben Oct 06 '13 at 9:38 am
source share