我无法从 R 中正确保存绘图

I cannot save correctly plots from R

我使用 boxplot 在 r 上创建了一个箱线图。

boxplot_nonorm= boxplot(log10(table_tissues_filtered_high+1), 
                        las=2, 
                        main= "Data not normalized",
                        col= "light green", )

然后我将其另存为图像和 pdf,但生成的文件被截断了。我报告一个例子

我看不懂标签名称。我该如何解决?

您需要在保存图之前增加边距。您可以使用 par() c(bottom, left, top, right)

中的 mar 更改页边距
png(filename="figure.png", width=900, bg="white")
par(mar=c(10,6,4,1))
boxplot(mtcars, names = c(paste0("very_long_label",1:11)), las = 2)
dev.off()