R2-38 第四期-ggplot2画饼图/箱型

jinhui 2017-11-23 04:39:16 阅读: 889

setwd("D:/projects/R learning/week 4 data")

library(ggplot2)

library(ggthemes)

library(lattice)

data1 <- read.csv("R.4-1.csv", header = T)

(graph1 <- ggplot(data1, aes(x = "", y=value, fill = city)) + geom_bar(stat = "identity", width = 1) + 

  coord_polar(theta = "y") + labs(x= "city", title = "R2-38")+

  theme(axis.ticks = element_blank()) + 

  theme(legend.title = element_blank(), legend.position = "top"))+

  scale_y_continuous(breaks=c(12, 14, 16, 18, 20))+

  theme(axis.title = element_text(size = 15, color = "tomato", face = "bold", vjust = 0.5, hjust = 0.5))+

  theme(axis.text.x = element_text(size = 10,  color = "green", face = "bold", vjust = 0.5, hjust = 0.5))

  

#####(原始数据的变量名均是中文,总是报错,我自己把所有变量名改为英文的,分别是id,city, value)  


(graph2 <- ggplot(singer, aes(x = voice.part, y = height, fill = voice.part))+geom_boxplot()+ 

  theme(legend.title = element_blank(), legend.position = "top")+

  theme(axis.title = element_text(size = 15, color = "gold", face = "bold", vjust = 0.5, hjust = 0.5)))+

  labs(title = "R2-38")

1.png

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

服务热线

178 0020 3020

微信服务号