服务热线
178 0020 3020
A1.用“pie”函数来绘制饼图,并学习调节相关参数。
> mydata <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12) > names(mydata) <- c("Blueberry", "Cherry","Apple", "Boston Cream", "Other", "Vanilla Cream") > pie(mydata, col=gray(seq(0,1,length = 6)),clockwise = TRUE,main = "pie chart")
A2
test different parameters
pie3D(mydata,height=10) > pie3D(mydata,height=1) > pie3D(mydata,height=0.1) > pie3D(mydata,height=0.1,edges= 1) > pie3D(mydata,height=0.1,edges= 5) > pie3D(mydata,height=0.1,edges= 10) > pie3D(mydata,height=0.1,edges= 1000) > pie3D(mydata,height=0.1,edges= 1000,radius= 9) > pie3D(mydata,height=0.1,edges= 1000,radius= 1) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 1) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 5) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 10) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.1) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.0) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.2) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 45) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 180) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 90) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 10) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.5) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 1) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 2) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 20) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "blue") > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "black") > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "green") > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "purple") > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "cyan") > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "cyan",col= rainbow(6)) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.5,theta= 0.5,start= 0.1,border= "cyan",col= rainbow(6),labels= names) > pie3D(mydata,height=0.1,edges= 1000,radius= 0.8,theta= 0.5,start= 0.1,border= "cyan",col= rainbow(6),labels = namesplot,explode = 0.2,labelcex = 0.75,labelcol = "green",main = "pie3D test")
additional-fan diagram
>install.packages(plotrix) > library(plotrix) >mydata <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12) >names(mydata) <- c("Blueberry", "Cherry","Apple", "Boston Cream", "Other", "Vanilla Cream") >namesplot <-c("Blueberry", "Cherry","Apple", "Boston Cream", "Other", "Vanilla Cream") > fan.plot(mydata,labels = namesplot, radius = 10,main="Fan Plot",col= rainbow(length(mydata)),label.radius = 12) > legend(x=4.5,y=1.2,namesplot, cex=0.8, fill= rainbow(length(mydata)))
附件