美文网首页
版本报错 | Updating ggplot2 code for

版本报错 | Updating ggplot2 code for

作者: biogeeker | 来源:发表于2021-05-24 22:35 被阅读0次

    Ref | Updating ggplot2 code for new version

    Since installing the latest version of ggplot2 (0.9.1), I have been getting messages from my old code including:

    > warnings()
    Warning messages:
    1: 'opts' is deprecated.
    Use 'theme' instead.
    See help("Deprecated")
    2: 'theme_text' is deprecated.
    Use 'element_text' instead.
    See help("Deprecated")
    8: In opts(title = trait axis.text.x = theme_text(size = fontsize$axis),  ... :
      Setting the plot title with opts(title="...") is deprecated. Use labs(title="...") or ggtitle("...") instead.
    9: 'opts' is deprecated.
    

    From Winston's github wiki, the key changes are:

    1. theme_xx() functions changed to element_xx()
      theme_segment() incorporated into theme_line()
    2. opts() changed to theme()
    3. opts(title = "mytitle") changed to labs(title = "mytitle")
    4. New features that make programming easier, e.g. ggtitle("mytitle") does the same as #3

    Here is a diff of some functions that I updated:

    相关文章

      网友评论

          本文标题:版本报错 | Updating ggplot2 code for

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