我想在R中绘制这个自定义图形,它在X轴上首先缩小比例,而在一个间隙之后,它再次以增加的比例开始。
图如下:
假设这是一个演示数据集。第一栏" THETA"是另外两列的X轴上绘制参数的值" ALPH"和" BET"在Y轴上但两者都有不同的比例。
theta alph bet
[1,] 0.1 0.9916 0.0002
[2,] 0.2 0.8727 0.0292
[3,] 0.3 0.6538 0.2083
[4,] 0.4 0.4544 0.4755
[5,] 0.5 0.3064 0.6554
[6,] 0.6 0.2160 0.7822
[7,] 0.7 0.1450 0.8535
[8,] 0.8 0.1025 0.9004
[9,] 0.9 0.0704 0.9294
[10,] 1.0 0.0497 0.9489
[11,] 1.1 0.0387 0.9673
[12,] 1.2 0.0274 0.9712
[13,] 1.3 0.0218 0.9814
[14,] 1.4 0.0148 0.9847
[15,] 1.5 0.0115 0.9868
[16,] 1.6 0.0085 0.9893
[17,] 1.7 0.0064 0.9920
[18,] 1.8 0.0052 0.9929
[19,] 1.9 0.0042 0.9952
[20,] 2.0 0.0045 0.9952
[21,] 2.1 0.0039 0.9978
[22,] 2.2 0.0023 0.9971
[23,] 2.3 0.0015 0.9988
答案 0 :(得分:0)
此示例显示如何自由定位和指定轴的值。如果数据不适合画布,则需要调整数据,如果在您的示例中这样做,我不清楚。
plot(type="n",0,0,xlim=c(0,20),ylim=c(0,15),xlab="",ylab="my y lab",axes=FALSE,cex.lab=0.5)
axis(side = 2,cex.axis=0.5)
add=9
pos=7
axis(side = 2,labels = c(-3,-2,-1,0,1,2,3),at = c(-3,-2,-1,0,1,2,3)+add ,pos = pos,cex.axis=0.5,line=1,las=2)
text(pos-1.5,add,"z-score",srt=90, cex=0.5)
add=11
pos=5
axis(side = 1,labels = c(9,8,7,6,5,4,3),at = c(-3,-2,-1,0,1,2,3)+add ,pos = pos,cex.axis=0.5,line=1,las=1)
add=3.3
pos=1
axis(side = 1,labels = c(-3,-2,-1,0,1,2,3),at = c(-3,-2,-1,0,1,2,3)+add ,pos = pos,cex.axis=0.5,line=1,las=1)