I would like to create a figure in which one of my factor levels (Bacillus) is italicized.
I have included the way I like to set up my data and how I create my figures -- I just need "Bacillus" to be italicized
IF_Eff_2 <- read_excel(("In-furrow x starter trial/2021 In-furrow x starter efficacy.xlsx"),
sheet = "2 yr metric")
IF_Eff_2$Fung <- factor(IF_Eff_2$Fung,
levels = c(1, 2, 3, 4),
labels = c("Fung1", "Fung2", "Fung3", "Bacillus"))
IF_Eff_2$Start <- factor(IF_Eff_2$Start,
levels = c(1, 2, 3),
labels = c("Fert1", "Fert2", "Fert3"))
IF_Eff_2$Rep <- factor(IF_Eff_2$Rep,
levels = c(1, 2, 3, 4))
IF_Eff_2$Year <- factor(IF_Eff_2$Year,
levels = c(2020, 2021),
labels = c(2020, 2021))
ggboxplot(IF_Eff_2, x = "Fung",
y = "RST",
fill = "Fung",
facet.by = "Year",
ylab = "Sucrose yield (g/kg)",
xlab = NULL)
theme_classic()
theme(legend.position = "none",
text=element_text(family="Calibri", size=30),
axis.text.x = element_text(angle = 45, vjust = 0.5),
axis.title.x = element_blank(),
plot.title = element_text(hjust = 0.5))
border()
geom_hline(yintercept = mean(IF_Eff_2$RST), linetype = 2)
theme(plot.background = element_rect(color="black",fill=NA,size=1.5))
stat_summary(fun=mean, geom="point", shape=8, size=5, color="black", fill="black")
This is currently my figure -- I just need Bacillus to be italicized
CodePudding user response:
Add
scale_x_discrete(labels = c("Fung1", "Fung2", "Fung3", expression(italic("Bacillus"))))
After your final line stat_summary(......)