如何在expression()中使用atop函数?

use*_*629 3 expression r plotmath

我需要添加换行符,但我正在努力使用atop函数expression().这main是我想要分成两行的部分.

> 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}*")"))
Run Code Online (Sandbox Code Playgroud)

Sve*_*ein 10

您没有指定要在哪里打破字符串,但此示例应该可以帮助您:

plot(1~1, 
 main=expression(atop("bla bla bla" ~ (K[d]),
                      "bla bla bla")))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • 谢谢你的帮助,这很好.但似乎atop函数比其他没有表达式函数并使用\n的图中的换行符引起了更多的间距.有没有办法让'atop'的标题相称 (4认同)
  • \n 由于表达式函数导致文本中间出现大的中断 (2认同)