You can adjust the values assigned to any aesthetic using scale_
X_manual(values=
(whatever))
. Here you want scale_fill_manual
.
ggplot(data=sdf,aes(x=hours,y=count,group=machine,fill=machine))+
geom_area(position="dodge") +
scale_fill_manual(values=c("red", "darkorchid", "green"))
Note that, as a rule, you want to let ggplot
group the data for you, as you have done in your second ggplot
call (This is what the group
argument does). Supplying each 'slice' of data separately, as you have done in your first example, pretty much defeats the purpose of ggplot2
, and should be avoided.