折线图
1.加载r包
library(tidyverse)
library(cowplot)
library(gapminder)
#install.packages("gapminder")
2.绘图
基本思想就是两步骤
- 先画线条 geom_line(size=1)
2.再加点 geom_point(shape=21,size=3,fill="white")+
filter(gapminder,country%in%c("China","India","Japan"))%>%
ggplot(aes(x=year,y=lifeExp,color=country))+
geom_line(size=1)+
geom_point(shape=21,size=3,fill="white")+
theme_minimal_hgrid()

网友评论