From R for Data Science
bar_mpg <- ggplot(mpg) +
geom_bar(aes(x = class, fill = class))
bar_mpg + coord_polar()
coord_map() projects a portion of the earth, which is approximately spherical, onto a flat 2D plane using any projection defined by the mapproj package. Map projections do not, in general, preserve straight lines, so this requires considerable computation. coord_quickmap() is a quick approximation that does preserve straight lines. It works best for smaller areas closer to the equator.
ggplot(data = mpg, mapping = aes(x = cty, y = hwy)) +
geom_point() +
geom_abline() +
coord_fixed()
coord_fixed() is a fixed scale coordinate system that forces a specified ration between the physical representation of data units on the axes. It is important because it ensures that one unit on the x-axis is teh same lenght as one unit on the y-axis, and makes ratios higher than one longer on the y axis than units on the x-axis and vice versa also.
geom_abline() adds a reference line that is diagonal (specified by slope and intercept). It is useful for annotating plots.