R - 笨辦法爲餅圖添加標籤

畫餅圖,擠在一塊兒了。手動加標籤,很蠢的辦法。code

ab.comp = c(4351,7114,217,517773)
lbls.ab = c("hehe","xixi","hoho","oh")
pColors = c("#214D8D", "#96D32B", "#ED3C30", "#86C7EC")

pie(ab.comp, col=pColors, labels = NA, clockwise = TRUE)
segments(0.01,0.8,-0.07,0.86)
segments(-0.07,0.86,-0.5,0.86)
#text(-0.20,0.86,lbls.ab[1], cex=0.9)
text(-0.6,0.86,lbls.ab[1], cex=0.9)
segments(0.07,0.8,0.07,0.86)
text(0.07,0.89,lbls.ab[2], cex=0.9)
segments(0.111,0.79,0.2,0.85)
segments(0.2,0.85,0.4,0.85)
#text(0.28,0.89,lbls.ab[3], cex=0.9)
text(0.5,0.86,lbls.ab[3], cex=0.9)
segments(0,-0.8,0,-0.85)
text(0,-0.9,lbls.ab[4], cex=0.9)
相關文章
相關標籤/搜索