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)")
```

cnliutz

计算机基础教师

发表评论

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