2012-01-09 60 views
2

有沒有方法可以在R圖中設置條邊的寬度? 例如,當我設置R圖中條的邊緣寬度

test <- read.csv(file="test4.csv",sep=",",head=TRUE) 
pdf(file="test.pdf", height=4, width=6) 
barplot(as.matrix(test[,2:ncol(test)]), col=heat.colors(10), space=0.5) 
dev.off() 

我明白了。

This is the output

但是,所有的條的邊緣很厚相比,棒本身的寬度,因此,在底部和在較小的條的高度的黑色。

回答

8

您可以在繪製之前設置線寬。

opar <- par(lwd = 0.3) 

這將使較薄的酒吧,但不會影響你的軸(因爲它們分開設置)。

+1

您也可以在'barplot'調用中設置'border = NA'來完全省略邊框。 – joran 2012-01-09 22:24:52

+2

有趣的是,在調用'barplot',例如'barplot(runif(1e2),lwd = 0.3)'內設置'lwd''會改變y軸的厚度,但不會改變條的厚度。 – 2012-01-09 22:25:18

+0

@RichieCotton真實有趣的觀察 – 2012-01-09 22:33:04