R 在保存的PDF文件中生成LaTeX字体大小\条形图的脚注大小

R 在保存的PDF文件中生成LaTeX字体大小\条形图的脚注大小,r,latex,sweave,R,Latex,Sweave,代码生成的字体太小: pdf("fileName.pdf", width=100, height=50) par(mai=c(2, 1, 1, 1), lwd=2) barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"), main="Bar plot", names.arg=c("This is bar 1...1","This is bar 1...2", "Thi

代码生成的字体太小:

pdf("fileName.pdf", width=100, height=50)
par(mai=c(2, 1, 1, 1), lwd=2)
barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"),
        main="Bar plot",
        names.arg=c("This is bar 1...1","This is bar 1...2",
                    "This is bar 1...3","This is bar 1...4"),
        xpd=TRUE, las=2, lwd=2, 
        cex.axis=9, cex.names=9, cex.main=9)
dev.off()
pdf("fileName.pdf", width=100, height=50)
par(mai=c(2, 1, 1, 1), lwd=2)
barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"),
        main="Bar plot",
        names.arg=c("This is bar 1...1","This is bar 1...2",
                    "This is bar 1...3","This is bar 1...4"),
        xpd=TRUE, las=2, lwd=2, 
        cex.axis=18, cex.names=18, cex.main=18)
dev.off()
代码生成的字体太大:

pdf("fileName.pdf", width=100, height=50)
par(mai=c(2, 1, 1, 1), lwd=2)
barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"),
        main="Bar plot",
        names.arg=c("This is bar 1...1","This is bar 1...2",
                    "This is bar 1...3","This is bar 1...4"),
        xpd=TRUE, las=2, lwd=2, 
        cex.axis=9, cex.names=9, cex.main=9)
dev.off()
pdf("fileName.pdf", width=100, height=50)
par(mai=c(2, 1, 1, 1), lwd=2)
barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"),
        main="Bar plot",
        names.arg=c("This is bar 1...1","This is bar 1...2",
                    "This is bar 1...3","This is bar 1...4"),
        xpd=TRUE, las=2, lwd=2, 
        cex.axis=18, cex.names=18, cex.main=18)
dev.off()
问题: 如何获得与文档字体相同的字体大小,即\footnotesize

要获得LaTeX\footnotesize
cex
s必须为13、14或15。你知道如何获得正确的价值吗?它是可计算的吗?

一个“糟糕”的解决方案是通过加载PDF来比较PDF文件中的字体大小,并测量用{\footnotesize{0}}创建的“0”的大小(高度),以及在点(0,0)上用直尺或三角形直接显示在屏幕上的条形图中的“0”

cex
则为不同的条形图(具有不同的宽度和高度)提供了不同的帷幔。在我的情况下,它是
cex=9

通过将pdf加载为图像(例如PNG),并通过计算选择手动创建的文本和条形图的区域,在每个区域搜索一个“0”,并相互比较两个零,可以实现相同的计算方法


如果您对如何有效地使用一系列代码有任何想法,请回复并给出您的想法

创建PDF文件后是否可以进行比较?我的意思是检查PDF文件:读取并计算文本和创建的图形的大小。