0

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:

current chart

KillerSnail
  • 3,321
  • 11
  • 46
  • 64
  • 3
    Can you include the output of this code or at least include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can run the code to see what the output is? I really can't tell what you're trying to change. – MrFlick Aug 05 '15 at 03:24
  • this is from someone else's shiny app which I am trying to reverse engineer and reformat. is there a way to extract data structures from within a running app? – KillerSnail Aug 05 '15 at 03:31

0 Answers0