我已在基准R中创建了一个图,包括3个修剪的“ ablines”。尽管使用了“ frame.plot = FALSE”功能,但该功能删除了绘图周围的框(请参见示例1),但是当我添加修剪的[使用ablineclip]临时工时,新的框架线仍出现在其上方(参见示例2)。
我正在使用的代码如下所示:
library(plotrix)
op <- par(mar=c(5, 6, 4, 2) + 0.1)
plot(dif2$land_area ~ dif2$Year_no, ylim = c(1,4000), col.axis = rgb(68, 84, 106,max=255),xaxt='n', type='o', pch=16, col='red', font.axis=2, font.lab=2, col.lab=rgb( 113, 113, 113, max=255), xlab = 'Year', ylab = 'Total Land Area Changed to \nResidential Development (Ha)', frame.plot = FALSE, cex=1.3)
rect(23.2,0,25.8,4000,col='grey',density = 8,border=T)
rect(10.2,0,11.8,4000,col='grey',density = 8,border=T)
xlim(0,30)
axis(1,at= 1:30,labels=F)
axis(1,at= 1:30,tick=F, font.axis=2, col.axis = rgb(68, 84, 106, max=255),labels= c(1989:2018))
# the below section is that which seems to create the issue #
ablineclip(lm(land_area ~ Year_no, data = subset(dif2, int==0)), col='blue', lty=2, x1=1,x2=10, lwd=0.8)
ablineclip(lm(land_area ~ Year_no, data = subset(dif2, int==0)), col='blue', lty=2, x1=12,x2=23, lwd=0.8)
ablineclip(lm(land_area ~ Year_no, data = subset(dif2, int==1)), col='blue', lty=2, x1=26,x2=30, lwd=0.8)
有人对为什么ablineclip函数似乎会改变绘图的边界有任何想法吗?
欢呼声