第五次作业R002-R语言绘制饼图

真·科研狗 2017-08-20 15:08:01 阅读: 1186
png(filename = "E:/R5-1.png")
pie(rep(1, 24), col = rainbow(24), radius = 0.9)
dev.off()

得到如下图片:

R5-1.png

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();

R5-2.png

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();

R5-3.png

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()

R5-4.png

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()

R5-5.png

 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2025 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号