Barchart: Legendary Italics
Tanya
I'm trying to keep the first label in the legend while converting the rest to italics, but I don't know how to do that. The code I use is:
ggplot(the_data_mod) +
geom_bar(aes(x = Protein, y = Protein_Abundance, fill = Mutant),
stat = "identity", position = position_dodge(), col = "white") +
theme_minimal()+
labs(title = "Relative Levels of TOC Protein Abundance across SP2 Mutants",
x = "Protein")+
ylab(expression(atop("Protein Abundance", paste("(Normalised Relative to WT)"))))
The data is:
structure(list(Mutant = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), .Label = c("WT", "ppi1", "sp2-4", "sp2-1 ppi1", "sp2-3 ppi1", "sp2-5 ppi1", "sp2-6 ppi1", "sp2-8 ppi1"), class = "factor"), Protein = c("TOC75", "TOC75", "TOC75", "TOC75", "TOC75", "TOC75", "TOC75", "TOC75", "TOC159", "TOC159", "TOC159", "TOC159", "TOC159", "TOC159", "TOC159", "TOC159" ), Protein_Abundance = c(100, 19.79, 209.85, 364.6, 183.14, 435.02, 22.23, 109.79, 100, 39.52, 266.72, 88.66, 105.04, 132.01, 99.7, 140.1349751)), class = "data.frame", row.names = c(NA, -16L))
Barbana
You can use the following code
ggplot(the_data_mod, aes(x = Protein, y = Protein_Abundance, fill = Mutant)) +
geom_bar(stat = "identity", position = position_dodge(), col = "white") +
scale_fill_discrete("Mutant",
labels = c(expression(italic("ppi1")),
expression(italic("sp2-1 ppi1")),
expression(italic("sp2-3 ppi1")),
expression(italic("sp2-4")),
expression(italic("sp2-5 ppi1")),
expression(italic("sp2-6 ppi1")),
expression(italic("sp2-8 ppi1")),
expression(italic("WT")))) +
theme_minimal()+
theme(legend.text.align = 0)+
labs(title = "Relative Levels of TOC Protein Abundance across SP2 Mutants",
x = "Protein")+
ylab(expression(atop("Protein Abundance", paste("(Normalised Relative to WT)"))))