採用 boxplot 繪圖時, x軸群組個數太多有可能會導致x軸群組文字無法顯示.
Analysis:
採用 cex.axis 指令即可放大(>1)或縮小(<1)其大小, 參考以下R指令:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# title: boxplot axis formation | |
# date: 2013/8/10 | |
# author: Ming-Ching Lee | |
op <- par(mfrow=c(1,2)) | |
length <- round(runif(200)*100,0) | |
types <- rep(paste("a", letters[1:10], letters[1:10], letters[1:10], letters[1:10], sep=""),20) | |
plant <- data.frame(length, types) | |
boxplot(length ~ types, data = plant) | |
boxplot(length ~ types, data = plant, cex.axis=0.8) | |
par(op) | |
# end |
比較下列圖形, 左圖預設值結果無法完整呈現群組文字, 右圖採用 cex.axis 參數設定, x軸群組文字較小且10個x軸群組文字皆可顯示.
感謝 R user- James 提供此問題.
沒有留言:
張貼留言