服务热线
178 0020 3020
png(filename = "E:/R5-1.png") pie(rep(1, 24), col = rainbow(24), radius = 0.9) dev.off()
得到如下图片:
2.
png(filename = "E:/R5-2.png") pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12) names(pie.sales) <- c("Blueberry", "Cherry", "Apple", "Boston Cream", "Other", "Vanilla Cream") pie(pie.sales, density = 10, angle = 15 + 10 * 1:6) dev.off();
3.
png(filename = "E:/R5-3.png") pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12) names(pie.sales) <- c("Blueberry", "Cherry", "Apple", "Boston Cream", "Other", "Vanilla Cream") pie(pie.sales, clockwise = TRUE, main = "pie(*, clockwise = TRUE)") segments(0, 0, 0, 1, col = "red", lwd = 2) text(0, 1, "init.angle = 90", col = "red") dev.off();
4.
png(filename = "E:/R5-4.png") library('plotrix') a<-c(23,45,67,89) b<-c('aaaaaa','baaaa','caaaa','daaaa') pie3D(a,labels=b,height=0.1,explode=0.05,main='3D pie') dev.off()
5. 首先用 install.packages("VennDiagram")来安装下包
png(filename="E:/R5-5.png") library(VennDiagram) A = 5:190 B = c(121:170,300:320) C = c(20:40,141:200) Len_A<-length(A) Len_B<-length(B) Len_C<-length(C) Len_AB<-length(intersect(A,B)) Len_BC<-length(intersect(B,C)) Len_AC<-length(intersect(A,C)) Len_ABC<-length(intersect(intersect(A,B),C)) a<-venn.diagram(list(A=A,B=B,C=C),filename=NULL,lwd=1,lty=2,col=c('red','green','yellow'),fill=c('red','green','yellow'),cat.col=c('red','green','yellow'),rotation.degree=2,reverse=TRUE) grid.draw(a) dev.off()
附件