Open dpolhamus opened 1 year ago
From offline conversation:
The lines below should work. Specifically, I think we'll have to determine the class, and then correctly handle the plotmath
attribute:
> lab.y <- latex2exp::TeX(paste("Probability of",str_replace(spec[[params$ep]]$short,"^Any","any")), output = "expression")
> lab.y
LaTeX: Probability of any AE, Grade $\geq 3$
plotmath: 'Probability of any AE, Grade ' * {phantom() >= phantom()} * 3
> sim_summary %>%
+ ungroup %>%
+ mutate(gl = sprintf("%s (%s)",JPGR, DOSCAT)) %>%
+ pmforest::summarize_data(value = prob, group = TYPEHER2, group_level= gl) %>%
+ pmforest::plot_forest(digits=2, x_lab = substitute(lab.y))
Hey @dpolhamus, im just getting to this issue now.
I was able to get the following code to work with pmforest 0.1.0
# Data
dataDir <- system.file("test-data", package = "pmforest")
plotData <- readRDS(file.path(dataDir, "plotData.RDS"))
# Summarize Data
sumData <- plotData %>%
summarize_data(
value = stat,
group = GROUP,
metagroup = param,
group_level = LVL
)
# latex2exp/plotmath label
lab.y <- latex2exp::TeX("probability of Grade $\\geq 3$", output = "expression")
> lab.y
LaTeX: probability of Grade $\geq 3$
plotmath: 'probability of Grade ' * {phantom() >= phantom()} * 3
plot_forest(sumData, x_lab = lab.y, CI_label=" ")
That yielded:
As you can see, the label updated correctly. Note that substitute(lab.y)
also worked, and returned the same plot. I'll leave the issue open for now just in case you discover some nuance in the near future.
Would be nice to pass expressions or plotmath to
x_lab
, e.g., particularlylatex2exp
output.