I used the scale_fill_identity
function already with some code of mine. Now - all of a sudden - when using it - it does not fill anything.
Here is an example:
# Create example data
data <- data.frame(x = c(1, 2, 3), y = c(4, 5, 6), fill = c("red", "blue", "yellow"))
# Create the plot
ggplot(data)
geom_point(aes(x = x, y = y, fill = fill))
scale_fill_identity()
This gives me this:
So no color. Any suggestions on where the problem could be?
CodePudding user response:
You could color your points using scale_color_identity
:
library(ggplot2)
# Create the plot
ggplot(data)
geom_point(aes(x = x, y = y, color = fill))
scale_color_identity()
Created on 2023-01-25 with reprex v2.0.2
Please check this for more examples about using scale_identity
.