I am trying to add a legend to the following code in R, gplot2 for a stacked area chart:
plot1<-ggplot(data=agegenderdata,
aes(x=agegenderdata$Year,
y=agegenderdata$`Obesity Inpatients`,
fill=agegenderdata$`Age Category`))
plot1withGeom <- plot1 + geom_area(aes(colour=agegenderdata$`Age Category`, fill=agegenderdata$`Age Category`))
plot1withGeom + labs(x = "Year", y = "Obesity Inpatients", title = "graph" )
However, when checking online and trying different methods to change the legend title I have had little luck. Could someone please help.
Greatly appreciated.