第五期任务-饼图和3D饼图-011

blanking 2017-08-17 11:53:00 阅读: 1025

x <- read.csv('/Users/taowang/documents/R/GDP.csv')

head(x)

GDP <- x[,-1]

head(GDP)

pdf(file = "pie1.pdf")

pie(GDP)

dev.off()

pdf(file = "pie2.pdf")

pie(GDP,labels = '')

dev.off()

pdf(file = "pie3.pdf")

pie(GDP,labels = '',radius = 1)

dev.off()

pdf(file = "pie4.pdf")

pie(GDP,labels = '',radius = 1, col = rainbow(31))

dev.off()

pdf(file = "pie5.pdf")

pie(GDP,labels = '',radius = 1, col = rainbow(31), clockwise = T)

dev.off()

pdf(file = "pie6.pdf")

pie(GDP,labels = '',radius = 1, col = rainbow(31), clockwise = T, init.angle = 45)

dev.off()

pdf(file = "pie7.pdf")

pie(GDP,labels = '',radius = 1, 

    col = rainbow(31), clockwise = T, 

    density = 10,

    angle = 10*0:30

    )

dev.off()

pdf(file = "pie8.pdf")

pie(GDP,labels = '',radius = 1, 

    col = rainbow(31), clockwise = T, 

    init.angle = 45,

    main = 'GDP'

    )

dev.off()

pdf(file = "pie9.pdf",8,6)

pie(GDP,labels = '',radius = 1, 

    xlim = c(0,6),

    ylim = c(0,6),

    col = rainbow(31), clockwise = T, 

    init.angle = 45,

    main = 'GDP'

)

legend('topright', legend = x$X, fill = rainbow(31),

       cex = 0.65

       )

dev.off()

library(plotrix)

pdf(file = "pie3D-1.pdf")

pie3D(GDP,radius = 1, height = 0.2,

      main = 'GDP'

      )

dev.off()

pdf(file = "pie3D-2.pdf")

pie3D(GDP,radius = 1, height = 0.2,

      main = 'GDP'

)

legend('topright', legend = x$X, fill = rainbow(31),

       cex = 0.65

)           #legend不会调整

dev.off()

install.packages('VennDiagram')

library(VennDiagram)

library(grid)

library(futile.logger)

set.seed(1001)

x1 <- sample(1:100,50,replace = T)

set.seed(1002)

x2 <- sample(1:100,50,replace = T)

set.seed(1003)

x3 <- sample(1:100,50,replace = T)

T <- venn.diagram(list(A=x1,B=x2,C=x3),filename = 'venn.tiff',lwd=1,lty=2,col=rainbow(3),

                  fill=rainbow(3),cat.col=rainbow(3))

grid.draw(T)

 
邀请讨论

附件

{{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-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号