How do I make a legend appear and theme it for the following ggplot2
?
The ggplot2
code is:
ggplot(data=df, environment=environment()) + ylab("YVAR") + xlab("XVAR") +
#Actuals with dots
geom_line( aes( x = Ratio, y = value), colour='#8EA5B7', size = 1.5) +
geom_point(aes(x=Ratio,y=value)) +
#Line for the predictive model with dots
geom_line(aes( x = Ratio, y = p), colour='#DC8772', size = 3) +
geom_point(aes(x=Ratio,y=p)) +
#labels for the actual points
geom_text(aes( x = Ratio, y = value, label = Total), size = 5) +
# 3 standard devs max limit
geom_line(aes( x = Ratio, y = sigma3 ), linetype = 'dashed' ) +
# 3 standard devs min limit
geom_line(aes( x = Ratio, y = sigma3m ), linetype = 'dashed') +
# code for the formula
geom_text(aes( x = 0.01, y = 0.5, label = my_label), colour="black", size=5, parse = TRUE) +
#scale variable
scale_colour_manual(values=c("Actual Readings", "Predictive Model")) +
# change background colour
theme_bw()
I tried to mess around with theme but it wasn't working.
In the legend I just want entries for the geom_line
not for the geom_text
and the geom_points
.
at the moment it looks like this: