折线图

2022-12-21  本文已影响0人  余绕

折线图

1.加载r包
library(tidyverse)
library(cowplot)
library(gapminder)
#install.packages("gapminder")
2.绘图

基本思想就是两步骤

  1. 先画线条 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()
image.png
上一篇 下一篇

猜你喜欢

热点阅读