# ensures that the ranges of axes are equal to the specified ratio by
# adjusting the plot aspect ratio
qplot(mpg, wt, data = mtcars) + coord_equal(ratio = 1)
qplot(mpg, wt, data = mtcars) + coord_equal(ratio = 5)
qplot(mpg, wt, data = mtcars) + coord_equal(ratio = 1/5)
# Resize the plot to see that the specified aspect ratio is maintained
Run the code above in your browser using DataLab