Skip to content

Ridgeline axis labels and density + hist  #272

@jpsmithuga

Description

@jpsmithuga

Hello,

Two comments pertaining to Section 9: Ridgeline Plots.

  1. The axis labels on the Ridgeline example are all right justified. This can be fixed by adding center = TRUE in the theme_ridges() command, i.e. theme_ridges(center = TRUE).

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions