Closed jenni-gnz closed 2 months ago
@jenni-gnz - this code does what you want
library(ssdtools)
library(ggplot2)
library(latex2exp)
gp <- ssd_plot(ssddata::ccme_boron, boron_pred, label = "Species", shape = "Group")
gp + scale_x_continuous(TeX("Concentration ($\\mu g$/L)"))
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
Created on 2024-09-18 with reprex v2.1.1
Thanks. I also had to add into scale_x_continuous(..., breaks = c(1, 10, 100, 1000, 10000)) to stop the scale labels changing to the squished up look.
For those that want a subscript in there, here is a solution:
scale_x_continuous(TeX("Copper $EC10_{my subscript}\\phantom{x}(\\mu g$/L)$"), breaks = c(1, 10, 100, 1000, 10000))
(this took ages to figure out as extra spaces were added with various other options, so adding here in case anyone else wants it, including future me)
Thanks @jenni-gnz - we'll add it to the FAQs
done in dev branch
I would like to label the x-axis in ssdplots with “Dissolved copper (ug/L)” where the u is actually a mu. Usually I do this with expression in xlab(), but the way that the plot ssd_plot function works it doesn’t update if I use + xlab(expression("Copper EC10 value ("mu"g/L)")); and if I use an expression within ssd_plot (xlab = "xxxx") that doesn’t work either. Is there a way to allow x-labels to be added that allows for expressions and symbols? Thanks