我想在同一图像中有多个图,我想根据图像得到不同数量的图.确切地说,我首先创建一个1x2的图表矩阵,然后创建一个3x2的图表矩阵.我想对这两个图像使用相同的基本设置 - 特别是相同的字体大小,因为这是针对纸张的,并且字体大小必须至少为6磅.
为了实现这一点,我为R编写了以下代码:
filename = "test.png"
font.pt = 6 # font size in pts (1/72 inches)
total.w = 3 # total width in inches
plot.ar = 4/3 # aspect ratio for single plot
mat.col = 2 # number of columns
mat.row = 1 # number of rows
dpi = 300
plot.mar = c(3, 3, 1, 2) + 0.1
plot.mgp = c(2, 1, 0)
plot.w = total.w / mat.col - 0.2 * plot.mar[2] - 0.2 * plot.mar[4]
plot.h = plot.w …Run Code Online (Sandbox Code Playgroud)