饼状图
x<-c(2,3,4)
labels<-c("US","UK","France")
pie(x,labels,col=c("red","yellow","purple"))
slices <-c(10,12,4,16,8)
lbls<-c("US","UK","Australia","Germany","France")
pie(slices,labels = lbls, main = "Simple pie chart")
pct <- round(slices/sum(slices)*100)
lbls2 <-paste(lbls," ",pct,"%",sep = "")
pie(slices,labels = lbls2, main = "Simple pie chart with percentanges",
col = rainbow(length(lbls2)))
library(plotrix)
pie3D(slices,labels = lbls, main = "3D pie chart",explode=0.1)
mytable <- table(state.region)
lbls3<- paste(names(mytable),"\n",mytable, sep = "")
pie(mytable,labels = lbls3,
main = "pie chart from a table\n (with sample sizes)")
library(plotrix)
slices <-c(10,12,4,16,8)
lbls<-c("US","UK","Australia","Germany","France")
fan.plot(slices,labels = lbls, main = "Fan Plot")