I've tried searching for a solution to this seemingly easy problem, but to no avail. All I'm trying to do is plot a line in ggplot and its standard deviation around the line. However, I keep recovering this error:
Error: Discrete value supplied to continuous scale
My data frame plotdata
is as follows:
sites Spoly Spolylower Spolyupper
526.790 0.03018671 0.1196077 0.1196077
1538.512 0.04106053 0.1429613 0.1429613
2540.500 0.02896953 0.1127456 0.1127456
3541.000 0.03560484 0.1200609 0.1200609
4560.143 0.06038193 0.1564464 0.1564464
5569.831 0.03608714 0.1296704 0.1296704
I can plot just the line perfectly fine:
ggplot(data = plotdata, aes(x = "Sites", y = "Mean Values")) +
geom_line(aes(x = sites, y = Spoly), color = "steelblue")
But when I try to add the ribbon, I get the error:
ggplot(data = plotdata, aes(x = "Sites", y = "Mean Values")) +
geom_line(aes(x = sites, y = Spoly), color = "steelblue") +
geom_ribbon(aes(x = sites, ymin = Spolylower, ymax = Spolyupper), alpha = 0.3)
Error: Discrete value supplied to continuous scale
What is going on? What am I doing wrong here?