In the following plot, I would like to replace "d" by delta, include a per mil symbol at the end, and use superscripts in: d13C, d15N and d34S.I got it when I use a biplot (e.g. plot + ylab(expression(paste(delta^{15}, "N (\u2030)")))). However, in the attached plot, I'm using facet_grid, which may change the way to get it. Here is the script used:
group.violin<-ggplot(group.data, aes(x=Culture2, group = Culture2, y=value)) +
stat_summary(aes(x = Culture2, y = value, color= Species, group = Species), fun = "mean",
geom = "line", lwd = 2, alpha = 0.5)+
stat_summary(geom="point")+
geom_violin(aes(x = Culture2, y = value, fill = Species), alpha = 0.4, color = NA)+
geom_point(aes(x = Culture2, y = value, fill = Species), size = 3, color = "black", pch = 21,
position = position_jitter(width = 0.05, seed = 12))+
facet_grid(variable ~ Species, scales = "free_y") +
xlab("")+
ylab("")+
theme_classic()+
theme(strip.background = element_rect(colour = "black", fill = "grey85", size = 0.1),
panel.border=element_rect(colour="black",size = 0.1, fill = NA),
panel.spacing = unit(0.3, "lines"),
axis.text.y = element_text(size = 12, colour = "black"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
legend.position = "bottom",
legend.text=element_text(size=12, face="italic"),
legend.title=element_text(size=12,face="bold"),
strip.text.x=element_text(size=12,face="bold.italic"),
strip.text.y=element_text(size=12,face="bold"))


We can use
subto change yourvariableto be the labels you expect, then addlabeller=label_parsedto the call tofacet_grid.Using my sample data (below), original plotting code:
Unfortunately, this drops the bold/italic formatting you
themed into the facet labels, so we need to be clearer on those. Further, having bold-italic in the facet strips and just italic in the other poses a small problem ... but I'll hack it into place by usingplotmath-like"bolditalic(..)"expressions (strings) for everything, and then remove theboldportion of that string for just the legends.For this step, we'll transform
Speciesas well, then addscale_colour_discreteand_fill_hacks usingscales::label_parsefor thelabels=argument.Sample data: