[英]Change the distance between multiple lines in axis label
I need to plot two lines for x-axis label. 我需要为x轴标签绘制两条线。 Because I need to use special font I choose to use "expression" with "atop".
因为我需要使用特殊字体,所以我选择使用“表达式”和“atop”。 The problem is that the distance between the two lines is much bigger than that if I just use "\\n".
问题是,如果我只使用“\\ n”,两条线之间的距离要大得多。 Like the following:
如下:
xlabs <- c('change in log2\nsample A',
expression(atop('change in'~log['2'], 'sample B')))
I got something like this: 我有这样的事情:
Anyone knows how to solve the problem? 谁知道如何解决问题?
I think using an expression vector is what was requested: 我认为使用表达式向量是我们所要求的:
exl <- list(quote(line~1), quote(line~2))
plot(0:1,0:1,type="n",xlab="")
mtext(side=1, do.call(expression,exl),line=1:2)
These also succeeds (and might point the way to a more flexible approach to using an expression vector: 这些也取得了成功(并且可能指向更灵活的方法来使用表达式向量:
plot(0:1,0:1,type="n",xlab="")
mtext(side=1, expression(line*1, line*2), line=1:2)
plot(0:1,0:1,type="n",xlab="")
mtext(side=1, c(bquote(line==.(round(exp(1),2))), expression(line*2)), line=1:2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.