Add legend ggplot2

43 views
Skip to first unread message

joao paulo honorato machado

unread,
Jan 17, 2017, 1:50:52 PM1/17/17
to ggplot2
I need to add a caption and I can not. The file contains the attached data contains the data and here follows the script I am using in ggplot2 !!!

library(dplyr)
library(ggplot2)

as1<-read.table("as1.txt", header=TRUE)
as1$dos <- as.factor(as1$dos)

as <- summarize(group_by(as1, dos),
                der_dp = sd(ger),
                ger_mean = mean (ger),
                der2_dp = sd(ger2),
                ger2_mean = mean (ger2))


ggplot(as, aes(x = dos, y = ger_mean, group=1)) +  
  geom_line(color= "red", size = 1.2) +
  geom_line(aes(x = dos, y = ger2_mean), color= "blue", size = 1.2)+
  geom_errorbar(aes(ymin = ger_mean - der_dp , ymax = ger_mean + der_dp),width = 0.1, size=1, color = "red", linetype= 1) +
  geom_errorbar(aes(ymin = ger2_mean - der2_dp , ymax = ger2_mean + der2_dp),width = 0.1, size=1, color = "blue", linetype= 1) +
  geom_point(shape = 19,size = 4, color = "red") + theme_grey() +
  geom_point(aes(x = dos, y = ger2_mean),shape= 19, color= "blue", size = 4)+
  labs(title = "Volume água em litros") + labs(x = "Volume (L)") +
  labs(y = "Evaporação (%)") + coord_cartesian(ylim = c(0, 120))
as1.txt
Reply all
Reply to author
Forward
0 new messages