【发布时间】:2019-05-30 10:32:59
【问题描述】:
我花了几个小时搜索并试图找到一种使用表达式或 bquote 的方法来为我制作的每个图表创建一个新标题。我遇到的问题是每个图表的标题名称都会发生变化,并且每个名称中有不同数量的下标和上标。如何格式化我的“main=”语句以使用我想要的各种下标和上标更改为新的标题名称?
# This is the format I want to show on the graphs
# Title Graph1 = "Total pH" (no super or subscripts)
# Title Graph2 = "Total NO3-" where "3" subscript and "-" superscript
# Title Graph3 = "Total H2PO3-" where "2" subscript, "3" subscript, and "-" superscript
# Title Graph4 = "Total K+" where "+" is superscript
n <- c("pH", "NO3-", "H2PO3-", "K+")
for (j in n) {
dev.new(width=10, height = 10)
plot (x=2,y=3, main=j)
}
【问题讨论】:
-
我应该补充一下,我希望为轴标签以及主要标签执行此操作,这就是我添加标签轴标签的原因。我假设如果有解决方案,相同的过程将适用于两个绘图功能。
标签: r plot axis-labels