0

I'm confused why below code doesn't work. ggplot help for aes or fill or geom_density say that a) geom_density understands the fill aesthetic and b) that fill can be a colour constant from the R color palette. So what am I missing?

data.frame(x = rnorm(1:1000),
           y = rnorm(1:1000)) |> 
  ggplot2::ggplot() +
  ggplot2::geom_density(ggplot2::aes(.data$x, fill = "yellow")) +
  ggplot2::geom_density(ggplot2::aes(.data$y, fill = "green"))

enter image description here

deschen
  • 10,012
  • 3
  • 27
  • 50

0 Answers0