0

I need a legend in order to see the difference between green and blue doots with some text.

scatter_figure_blade <- ggplot() + 
  theme_bw() + 
  theme(plot.title = element_text(size = 12, face = "bold", hjust = 0.5)) + 
  geom_point(data=rp_16_8, aes(x=r_16_8, y=p_16_8), colour = "green", size = 3) + 
  geom_point(data=rp_8_16, aes(x=r_8_16, y=p_8_16), colour = "blue", size = 3) + 
  scale_color_manual(name = "Deployments" (?)) +  
  labs(x = bquote("Reliability" ~ (1 - P[f])), y = "Power Consumption (W)", title = "Google Traces") 
markus
  • 25,843
  • 5
  • 39
  • 58
  • 1
    Read [this answer](https://stackoverflow.com/a/3777592/8583393) from the question: [Plotting two variables as lines using ggplot2 on the same graph](https://stackoverflow.com/questions/3777174/plotting-two-variables-as-lines-using-ggplot2-on-the-same-graph) – markus Nov 17 '20 at 15:13

1 Answers1

0

I already found a very easy solution.

  scatter_figure_blade <- ggplot() + 
  theme_bw() + 
  theme(plot.title = element_text(size = 12, face = "bold", hjust = 0.5)) + 
  geom_point(data=rp_16_8, aes(x=r_16_8, y=p_16_8, color = "#2778d8"), size = 3) + 
  geom_point(data=rp_8_16, aes(x=r_8_16, y=p_8_16, color = "#bb8fce"), size = 3) + 
  labs(x = bquote("Reliability" ~ (1 - P[f])), 
       y = "Power Consumption (W)", 
       title = "Google Traces", 
       color = "Deployment") + 
  scale_color_manual(values = c("#2778d8", "#bb8fce"),
                     labels = c("16x8", "8x16"))