R绘制饼图

```{r}
par(mfrow=c(2,2))
slice<-c(10,12,4,16,8)
lbls <- c("US","UK","Australia","Germany","France")
pie(slice,labels = lbls,main = "Simple Pie Chart")
pct <- round(slice/sum(slice)*100)
lbls2 <- paste(lbls,' ',pct,"%",sep = " ")
pie(slice,labels = lbls2,col=rainbow(length(lbls2)),main = "Pie Chart with Percentages")

library(plotrix)
pie3D(slice,labels=lbls,explode=0.1,main="3D Pie Chart")

mytable <- table(state.region)
lbls3 <- paste(names(mytable),"\n",mytable,sep=" ")
pie(mytable,labels = lbls3,main = "Pie Chart from a table\n (with sample size)")

```