【发布时间】:2020-01-17 15:48:03
【问题描述】:
我想在 ggplot 中添加以下标题:
"Number of times where UK emissions of Sulphur Dioxide exceeded 10 microgrammes per metre cubed"
本题的组成部分来自:
free text = "Number of times where UK emissions of "
input$select = Sulphur Dioxide (or any other pollutant the user selects)
free text = "exceeded "
input$number = 10 (or any other integer the user selects)
formula = μg/m3 (where the 3 is superscript of m)
使用了 paste 和 expression 和 bquote 的组合,但结果不正确。
这是我上面的代码......
ggplot() +
aes(x=year, y=cnt) +
labs(title = paste("Number of times where UK emissions of ", input$select,
" exceeded", input$number, expression(mu), "g/m", "^{3}"))
【问题讨论】:
-
expression和bquote的组合到底是什么样的?如果您提供某种reproducible example 来简化测试可能的解决方案,这将有所帮助。您使用闪亮的事实并不是那么相关。假设input$中的所有内容都可能是一个字符串。 -
我不确定你在问什么,但如果你使用
"\u03BCg/m\u00B3"作为μg/m³部分,它会很好地打印出来。 -
已将我的代码添加到原始问题中
-
你这个小美女@AllanCameron。这很有效:) 谢谢一百万。
-
很棒的@stixmcvix。已添加为答案。