没有表达式功能的情况下,如何在ggplot标签中添加上标?

请参见下面的代码。

我想在y轴上添加上标,以便我的“ y.units.vec.time”在用户从选项菜单中选择的任何选项上都添加上标。

据我了解,我无法在ggplot()之外正确使用expression()。有什么方法可以在“ y.units.vec.time”的选项菜单中添加上标?

如果我在ylab()中使用expression(),我的输入(plot.y.label)将按字面意义读取并放在y轴上。

  y.units.vec.conc <- c("M","mM","μM","nm")
      y.units.vec.time <- c("sec","min","hr","day")

      y.index.units.1 <- menu(y.units.vec.conc,graphics = FALSE,title = "y-axis: What are the units of concentration?")
      y.index.units.2 <- menu(y.units.vec.time,title = "y-axis: What are the units of time?")

      plot.y.label <- paste("Reaction Rate",y.units.vec.conc[y.index.units.1],y.units.vec.time[y.index.units.2],sep = " ")



      p_sat_curve_1 <- ggplot(data = d_sat_2,mapping = aes(x = sub.conc,y = slope.m)) +
        geom_point(size = 1.5) +
        theme_bw() +
        xlab(plot.x.label) +
        ylab(plot.y.label)
yxm407949656 回答:没有表达式功能的情况下,如何在ggplot标签中添加上标?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3156718.html

大家都在问