r - 使用闪亮的输入、文本和希腊字母向 ggplot 添加标题
问题描述
我想将以下标题添加到 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)
使用了粘贴和表达式以及 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}"))
解决方案
我不确定你在问什么,但如果你用它"\u03BCg/m\u00B3"
来μg/m³
打印它会很好地打印出来。
推荐阅读
- scala - 使用不同的设置两次运行 sbt 任务
- node.js - 带有令牌的 PASSPORT GOOGLE OAUTH2
- node.js - 使用快递的 POST 请求
- sql - 是否可以有两个“THEN”语句与一个条件?
- bash - 可以在 macOS 中读取键盘快捷键表吗?
- java - 如何将消费者组与 Spring Data Redis 一起用于 Redis Streams(不断获得 NOGROUP)?
- huggingface-transformers - 多个序列的罗伯塔标记化
- c# - Unity 的弧度/度数设置是否取决于用户设置?
- java - Gradle 在单元测试期间运行 flywayMigration
- python - 单击:通过覆盖 UsageError 的 show 函数自定义“缺少参数”错误处理