line-plots-CRF.R 2.46 KB
# Based on http://www.sthda.com/english/wiki/ggplot2-line-plot-quick-start-guide-r-software-and-data-visualization

library(ggplot2)
#library(ggpubr)
#library(cowplot)

######### BEST MODELS ##########

# Run1
dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=15),
                Strategy=rep(c(
                  "Agit",
                  "Gversion",
                  "Substrain",
                  "Vess",
                  "OD",
                  "Anti",
                  "Supp",
                  "Air",
                  "Gtype",
                  "Med",
                  "Temp",
                  "Technique",
                  "Phase",
                  "pH",
                  "Strain"
                ),3),
                Score=c(
                  0,
                  0,
                  0,
                  0,
                  1,
                  1,
                  0.883,
                  0.92,
                  0.905,
                  0.852,
                  0.818,
                  0.88,
                  1,
                  1,
                  1,
                  0,
                  0,
                  0,
                  0,
                  0.405,
                  0.444,
                  0.669,
                  0.742,
                  0.811,
                  0.912,
                  1,
                  1,
                  0.947,
                  1,
                  1,
                  0,
                  0,
                  0,
                  0,
                  0.577,
                  0.615,
                  0.762,
                  0.821,
                  0.856,
                  0.881,
                  0.9,
                  0.936,
                  0.973,
                  1,
                  1
                ))
head(dfa)

pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) +
  geom_line(aes(color=Measure))+
  geom_point(aes(color=Measure))+
  scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+
  #scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+
  geom_text(aes(label = Score))+
  labs(title="Prediction of the best model (Run1)",x="Conditions", y = "Score")+
  theme(
    legend.position="top",
    # Centrar título: plot.title = element_text(hjust = 0.5),
    axis.line = element_line(colour = "gray"),
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank()
  )
pa

ggsave(".png")