换行符表达式

时间:2014-01-10 15:18:14

标签: r expression

是否可以在expression()函数中生成换行符?粗体文本需要分成至少2个句子。

plot (DAC~Chlo, data = brazilw, pch = 15, col = "red", cex = 0.5,
  **main=expression("Fig. 3. Relationship between diffuse attenuation coefficient at 490 nm (K"[d]*") and chlorophyll concentration at three coral reef sites")**,
  xlab = expression("Chlorophyll concentration (mg "*m^{-3}*")"),
  cex.lab = 0.8, cex.main = 0.8, cex.axis = 0.8, font.main=1,
  ylim = c(0,0.3), xlim = c(0,3.5), ylab = expression("K"[d]*"(m "*-1^{-1}*")"))

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

我不确定我是否遗漏了某些内容,因为我没有您的数据集,所以您的代码段无法运行,只需将\n插入到您想要换行符的字符串中。< / p>

这是一个带有标题的简单情节:

plot(x = 1:10, y = 1:10, main=expression("Fig. 3. Relationship between diffuse attenuation coefficient at 490 nm (K"[d]*") and chlorophyll concentration at three coral reef sites"))

在R中运行它,你的标题会延伸到绘图窗口的边缘。现在运行它添加了一些新行:

plot(x = 1:10, y = 1:10, main=expression("Fig. 3. Relationship between\n diffuse attenuation\n coefficient at 490 nm (K"[d]*")\n and chlorophyll concentration at three\n coral reef sites"))

添加换行符,但不会全部适合上边距,您更改mai参数:par(mai = c(1,1,x,0.5))其中x是大小你的上边距的英寸。希望有所帮助。