[R] legend and values do not match in ggplot

greg holly mak.hholly at gmail.com
Fri Aug 4 15:52:56 CEST 2017


 I have following codes for ggplots. The legends are given in the plot do
not match with the values specified in the codes given below. Your helps
highly appreciated.

Greg

 library(ggplot2)
 p <- ggplot(a,aes(x=NO_BMI_FI_beta ,y=FI_beta ,color= Super.Pathway))+
 theme_bw() +theme(panel.border=element_blank()) +
 geom_point(size=3)
 p2<-p+scale_color_manual(name="Super.Pathway",
 labels=c("Amino Acid", "Cofactors and Vitamins", "Carbohydrate", "Energy",
"Lipid", "Peptide", "Nucleotide"),
 values=c("Amino Acid"="red",
 "Cofactors and Vitamins"="purple",
  "Carbohydrate"="darkgreen",
  "Energy"="orange",
  "Lipid"="darkblue",
  "Peptide"="darkred",
  "Nucleotide"="blue"))
  p2

	[[alternative HTML version deleted]]



More information about the R-help mailing list