Having installed tidyverse, I can't get the following to work....
ggplot(iris, aes(x = Sepal.Length, fill = Species) + geom_density(alpha = .3)
The error reads: "Error: Must request at least one colour from a hue palette."
Any ideas?
Having installed tidyverse, I can't get the following to work....
ggplot(iris, aes(x = Sepal.Length, fill = Species) + geom_density(alpha = .3)
The error reads: "Error: Must request at least one colour from a hue palette."
Any ideas?
Just for the record and for future readers, I had this error related with the specific column (iris$Species in this example) containing only NAs.
This happened because some libraries did not work properly after sourcing my code, and therefore some tables didn't have the proper format.
I cannot get this error from your code. Your code works well, you just missed a close parentheses ):
ggplot(iris, aes(x = Sepal.Length, fill = Species)) +
geom_density(alpha = .3)
The result is:
just for the record and for future readers, sometimes the sourcing of the code does not work
source("code_that_generates_data_for_ggplot.R")
and the data that is the GGPLOT input have one or more missing variables. This happens since some of the data is encoded in UTF-8.
A possible solution to this is using
source("code_that_generates_data_for_ggplot.R", encoding="UTF-8")
instead