问题描述
我将三个条形图组合成一个图:
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"
部分被切除:
我试图通过更改oma=c(0,3,0)
函数中的余量par()
来解决此问题:
png(file="random_precipitation2.png",1),oma=c(0,0))
barplot(x,cex.axis=1.5)
dev.off()
它会增加左侧的外边距,但文本仍被截断:
我尝试在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()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)