pie图绘制

x <- c(344,1619,1002,74,882,117,1292,58,68,158,73,303,139,579,92,93,2110,997)
label <-c("Black","Blue","Brown","Cyan","Green","Greenyellow","Grey","Grey60","Lightcyan","Magenta","Midnightblue","Pink","Purple","Red","Salmon","Tan","Turquoise","Yellow")
pie(x, labels = label,radius =1.8,col =c("black","blue","brown","cyan","green","greenyellow","grey","grey60","lightcyan","magenta","midnightblue","pink","purple","red","salmon","tan","turquoise","yellow"),clockwise = TRUE)
percent<-round(100*x/sum(x),2)
percent <-paste(percent, "%", sep = "")
pie(x, labels = percent,radius =1.8,col =c("black","blue","brown","cyan","green","greenyellow","grey","grey60","lightcyan","magenta","midnightblue","pink","purple","red","salmon","tan","turquoise","yellow"),clockwise = TRUE)
pie(x, labels = percent,main="饼图",radius =2.0,col =c("black","blue","brown","cyan","green","greenyellow","grey","grey60","lightcyan","magenta","midnightblue","pink","purple","red","salmon","tan","turquoise","yellow"),clockwise = TRUE)
pie(x, labels = percent,main="饼图",radius =2.0,col =c("black","blue","brown","cyan","green","greenyellow","grey","grey60","lightcyan","magenta","midnightblue","pink","purple","red","salmon","tan","turquoise","yellow"),clockwise = TRUE)
legend(locator(1),label, cex=1.2, fill=c("black","blue","brown","cyan","green","greenyellow","grey","grey60","lightcyan","magenta","midnightblue","pink","purple","red","salmon","tan","turquoise","yellow"))
分类R

发表评论

电子邮件地址不会被公开。 必填项已用*标注