2013-02-04 54 views
1

附加示例生成條件密度圖。在該示例中,我可以使用ylab = NA刪除「x」軸標籤,如果我使用yaxlabels = "n",則會刪除左側和右側刻度標籤。如何只刪除R cdplot中的左軸標籤?

我該如何只抑制左標籤(即「0」和「1」)並保持右手的概率尺度?

# Example 
Forest = c(1,0,1,1,1,0,1,1,0,1) 
change = c(-1, 3, 1, 4, 1, 1, -1, 1, -1, 6) 
mydata = data.frame(Forest,change) 

x = factor(mydata$Forest) 

cdplot(x~mydata$change, ylab = NA, xlab = NA) 

enter image description here

回答

4

正如你所說,你可以用yaxlabels = "n",以消除雙方的y標籤。 不僅僅是通過axis(4)添加右側軸。

Forest = c(1,0,1,1,1,0,1,1,0,1) 
change = c(-1, 3, 1, 4, 1, 1, -1, 1, -1, 6) 
mydata = data.frame(Forest,change) 

x = factor(mydata$Forest) 

cdplot(x~mydata$change, ylab = NA, xlab = NA, yaxlabels = "n") 
axis(4) 

enter image description here