如何显示图例并为以下ggplot2
设置主题?
ggplot2
代码为:
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()
我试图搞乱主题,但它没有用。
在图例中,我只想要geom_line
的条目不是geom_text
和geom_points
的条目。
目前它看起来像这样: