美文网首页
用R统计某领域文章的发布趋势

用R统计某领域文章的发布趋势

作者: RachaelRiggs | 来源:发表于2020-03-15 01:31 被阅读0次

    mac os 10.14
    yyplot的安装可见上一篇https://www.jianshu.com/p/2335ff6663dd,解决了mac安装过程中的错误。

    yyplot绘图代码如下:

    ##The script to abtain the trend of metagenomic##
    rm(list = ls())
    panel_title <- "The trend of adiponectin and metabolomics"
    sub_title <- "Source: https://www.ncbi.nlm.nih.gov/pubmed/"
    term <- c("metagenomic","adiponectin")
    year <- 1996:2019
    
    library(yyplot)
    library(ggplot2)
    library(ggrepel)
    pm <- pubmed_trend(term,year = year)
    colnames(pm)[1] <- "Year" # 修改列名
    colnames(pm)[3] <- "Articles"
    ggplot(data = pm,mapping = aes(x = Year,y = Articles)) + #本来忘记了data=,结果报错 dont know how to plot
      geom_point(aes(colour=TERM)) + geom_smooth(aes(colour=TERM)) + theme_bw() +
      ggtitle(panel_title, subtitle = sub_title)+
      geom_label_repel(aes(label= Articles)) +
      theme(
        plot.title = element_text(hjust = 0.5),
        axis.title.x = element_text(size = 16),
        axis.title.y = element_text(size = 16),
        axis.text.x = element_text(size = 12, colour = "grey50"),
        axis.text.y = element_text(size = 12, colour = "grey50"),
        legend.title = element_text(size=14),
        legend.text = element_text(size = 12),
        legend.key.size = unit(0.8,"cm")
      )
    ggsave("metagenomic_pubmed_trend.tiff",width = 10,height = 8)
    
    

    报错以后应当去查看该行的函数正确用法,是否出现了格式和用法上的错误。

    ggplot(data = surveys_complete, mapping = aes(x = weight, y = hindfoot_length))
    

    结果:


    image.png

    参考:https://www.jianshu.com/p/40676b44a1b2

    相关文章

      网友评论

          本文标题:用R统计某领域文章的发布趋势

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