I would like to make a density plot with a user-defined x-axis:
library(ggplot2)
ggplot(dataset, aes(x = VarX, fill = varFill)) +
scale_x_continuous(breaks = seq(0, 1000, by = 100)) +
geom_density(alpha= .5, aes(coulour = varFill)) +
xlim(c(0, 1000))
However, when I try the code above, I get the following message:
"Scale for 'x' is already present. Adding another scale for 'x', which will replace the existing scale."
The the "standard"-axis is shown.
I don't know, why the x-scale should be set already? Can anyone help please?