r - Multiple line diagrams in the same ggplot -
i creating line diagrams data. know how add line (with second set of recall , precision points) in same diagram?
recall11point = c(0.2, 0.2, 0.4, 0.4, 0.4, 0.6, 0.6, 0.6, 0.8, 1.0) precision11point = c(1.0, 0.5, 0.67, 0.5, 0.4, 0.5,0.43,0.38,0.44,0.5) d = data.frame("recall" = recall11point, "precision" = precision11point); # old fashioned plotting #plot(y=precision11point, x=recall11point, type="l") ggplot(data=d, aes(x=recall, y=precision)) + geom_line(size=2, colour="red") + geom_point(size=10)
d = data.frame( "recall" = c(0.2, 0.2, 0.4, 0.4, 0.4, 0.6, 0.6, 0.6, 0.8, 1.0) , "precision" = c(1.0, 0.5, 0.67, 0.5, 0.4, 0.5,0.43,0.38,0.44,0.5) , "recall2" = seq(0,0.9, = 0.1) , "precision2" = seq(0,0.9, = 0.1) ) library(ggplot2) ggplot(data=d) + geom_line(aes(x=recall, y=precision), size=1, colour="red") + geom_point(aes(x=recall, y=precision), size=5, color = "red") + geom_line(aes(x=recall2, y=precision2), size=1, colour="blue") + geom_point(aes(x=recall2, y=precision2), size=5, colour="blue") + theme_bw() + theme( panel.grid.minor = element_blank(), panel.grid.major = element_blank() )
Comments
Post a Comment