Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use coord_fixed(). This
will result in a 1:1 scaling between the x- and y-axes, as
shown in Figure 8-10:
library(gcookbook)# For the data setsp<-ggplot(marathon,aes(x=Half,y=Full))+geom_point()sp+coord_fixed()
The marathon data set
contains runners’ marathon and half-marathon times. In this case it
might be useful to force the x- and y-axes to have the same
scaling.
It’s also helpful to set the tick spacing to be the same, by
setting breaks in
scale_y_continuous() and scale_x_continuous()
(also in Figure 8-10):