gapminder<-read.csv("gapminder.csv",header = T)
library(ggplot2)
p <- ggplot(data = gapminder,
mapping = aes(
x = year,
y = lifeExp,
group = country))
p1<-p + geom_line() +
facet_wrap(~ continent)
p1
p2.1<- p1+
geom_hline(yintercept =40,linetype=2)+
geom_hline(yintercept =60,linetype=2)+
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(size=8, face = "bold"),
strip.text = element_text(size = 10, face = "bold"))
p2.1
p1<-p + geom_line() +
geom_point() +
facet_wrap(~ continent)
p1
p2.2<- p1+
geom_hline(yintercept =40,linetype=2)+
geom_hline(yintercept =60,linetype=2)+
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(size=8, face = "bold"),
strip.text = element_text(size = 10, face = "bold"))
p2.2
暂无评论