[英]line spacing in R/tikz figure annotation
我正在使用Tikz在R中制作人物。 我正在使用mtext将跨越两行的文本添加到页边距。 如何减少mtext生成的两行文本之间的距离?
这是R脚本的示例:
library("tikzDevice")
outfn<-"LineSpaceingExample.tex"
mydim <- 4
tikz(outfn,standAlone=TRUE,width=mydim,height=mydim)
mytext<- "This is some\nexample text"
x<-c(0, 1)
y<-x
plot(x, y, type = "n")
mtext(text=mytext, side=3,line=0.1)
dev.off()
为了澄清,我想控制“这是一些”和“示例文本”之间的垂直距离。
Googling的另一轮出现了一个解决方案 :在调用mtext
之前减小par()$lheight
。 以下脚本可以达到目的:
library("tikzDevice")
outfn<-"LineSpaceingExample.tex"
mydim<-4
tikz(outfn,standAlone=TRUE,width=mydim,height=mydim)
mytext1<- "This is the default\nline spacing"
mytext2<- "This is modified\nline spacing"
x<-c(0, 1)
y<-x
plot(x, y, type = "n")
mtext(text=mytext1, side=3,line=0.1, at=0.2)
par(lheight=0.8)
mtext(text=mytext2, side=3,line=0.1, at=0.8)
dev.off()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.