Ridgeline axis labels and density + hist
Hello,
Two comments pertaining to Section 9: Ridgeline Plots.
-
The axis labels on the Ridgeline example are all right justified. This can be fixed by adding
center = TRUEin thetheme_ridges()command, i.e.theme_ridges(center = TRUE). -
Additionally, the section states the histogram function "may not give us any valuable results" and that the density "gives better results." I don't exactly agree with this blanket statement and would avoid the use of superiority language as they provide different looks at the data and both may be an important consideration in certain instances. The density and histogram can be overlaid to provide both in one plot - I would suggest adding the following example, based on the InsectSprays dataset example provided in the section:
ggplot(InsectSprays, aes(x = count, y = spray, height = ..density.., fill = spray)) +
geom_density_ridges(scale = 1, alpha = 0.5, show.legend = FALSE) +
geom_density_ridges(stat = "binline", bins = 20, scale = 0.7, alpha = 0.9) +
scale_y_discrete(expand = c(0.01, 0)) +
scale_x_continuous(expand = c(0.01, 0)) +
theme_ridges(center = TRUE)
Thank you for considering these changes, Jonathan