折线图

作者: 余绕 | 来源:发表于2022-12-21 20:46 被阅读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

    相关文章

      网友评论

          本文标题:折线图

          本文链接:https://www.haomeiwen.com/subject/hogmqdtx.html