I have data that has two columns - date and values. I can create density plot with geom_density function. I would like to fill it with gradient color f.e. blue to red but I can't find how to do it. Anything I find on the internet requires Y value but I only have one variable.
Example of data:
Month_day; Temperature_anomaly
01-01; -1.24
01-02; 0.31
01-03; 1.13
01-04; -0.16
Code:
ggplot(data, aes(x = Temperature_anomaly)) +
geom_density()
This creates simple density plot but have do I create single density plot and add gradient fill color based on the same value(Temperature_anomaly) to it?