服务热线
178 0020 3020
第五期作业
1.饼图
1.1
x=c(40,18,17,15,14)
names(x)=c("帕金森病","多系统萎缩","肌萎缩侧索硬化","肌肉疾病","其它")
pie(x,col = rainbow(5), radius = 0.9,main="8月门诊病人构成")
1.2阴影图
x=c(40,18,17,15,14)
names(x)=c("帕金森病","多系统萎缩","肌萎缩侧索硬化","肌肉疾病","其它")
pie(x, density = 10, angle = 15 + 10 * 1:6)
2. 3D饼图
install.packages("plotrix")
library('plotrix')
a<-c(40,18,17,15,14)
b<-c("帕金森病","多系统萎缩","肌萎缩侧索硬化","肌肉疾病","其它")
pie3D(a,labels=b,height=0.1,explode=0.05,main="8月门诊病人构成")
4. 韦恩图
install.packages("VennDiagram")
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)
附件