I'm trying to create a series of boxplots between 3 groups which are graded on severeity of infection. This is the code I'm using:
pl <- ggplot(df.humann2.sub.all4, aes(x=PEDIS, y=PathAbundance, fill=PEDIS, group=PEDIS))
pl <- pl + geom_boxplot()
pl <- pl + facet_wrap(~ variable)
pl + scale_x_discrete()
pl + scale_x_discrete(limits=2:4)
However as you can see the legend is a continous scale instead of discrete groupings, how can I change this? Also question 2, you can see that one of the pathway titles is cut off, can I change the size of the plots or the size of the font titles to make sure the whole pathway name is visible?
Output of
dput(head)df.humann2.sub.all4,10))
structure(list(PEDIS = c(2L, 2L, 2L, 3L, 4L, 3L, 4L, 2L, 3L,
2L), variable = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("PWY.6385..peptidoglycan.biosynthesis.III..mycobacteria.",
"PWY.7221..guanosine.ribonucleotides.de.novo.biosynthesis", "PWY.7219..adenosine.ribonucleotides.de.novo.biosynthesis",
"PWY.7228..superpathway.of.guanosine.nucleotides.de.novo.biosynthesis.I",
"COA.PWY..coenzyme.A.biosynthesis.I"), class = "factor"), PathAbundance = c(0.239458,
1.3588, 6.00215, 0.371471, 1179.06, 0, 334.182, 96.3111, 55.3418,
8.63144)), row.names = c(NA, 10L), class = "data.frame")