从R中的3个图barplot切掉的2行轴标签

问题描述

我将三个条形图组合成一个图:

set.seed(10)
x <- runif(12,min=0,max=5)
months <- c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
colours <- c(rep("blue",2),rep("white",9),"blue")

png(file="random_precipitation.png",width=600,height=600)
par(mfrow=c(3,1))
barplot(x,names.arg=months,col=colours,ylab="Average precipitation \n(mm)",main="Random",cex.lab=1.5,cex.main=1.5,cex.names=1.5,cex.axis=1.5)
barplot(x,cex.axis=1.5)
dev.off()

我更改了y轴标签,并用"Average precipitation \n(mm)"使\n两行。

但是"Average precipitation"部分被切除:

See the left margin

我试图通过更改oma=c(0,3,0)函数中的余量par()解决此问题:

png(file="random_precipitation2.png",1),oma=c(0,0))
barplot(x,cex.axis=1.5)
dev.off()

它会增加左侧的外边距,但文本仍被截断:

enter image description here

我尝试在mar=函数中使用par()

png(file="random_precipitation2.png",mar=c(0,0))
barplot(x1,cex.axis=1.5)
barplot(x1,cex.axis=1.5)
dev.off()

这也不起作用,各个图重叠:

enter image description here

有没有办法增加页边距并包括截止文字

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...