服务热线
178 0020 3020
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")
附件