ggplot2 2.1.0 broke my code? Secondary transformed axis now appears incorrectly

前端 未结 3 523
情歌与酒
情歌与酒 2020-12-17 02:29

Some time ago, I inquired about adding a secondary transformed x-axis in ggplot, and Nate Pope provided the excellent solution described at ggplot2: Adding secondary transfo

3条回答
  •  心在旅途
    2020-12-17 02:55

    After some thought, I've confirmed that issue #1 originates from changes to recent versions of ggplot2, and I've also come up with a temporary workaround - installing an old version of ggplot2.

    Following Installing older version of R package to install ggplot2 1.0.0, I installed ggplot2 1.0.0 using

    packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_1.0.0.tar.gz"
    install.packages(packageurl, repos=NULL, type="source")
    

    which I verified with

    packageDescription("ggplot2")$Version
    

    Then, re-running the exact code posted above, I was able to produce a plot with the added x-axis correctly displayed:

    This is obviously not a very satisfying answer, but it at least works until someone smarter than I can explain why this approach doesn't work in recent versions of ggplot2. :)

    So issue #1 from above has been resolved. I'm still haven't resolved issue #2 from above, so would appreciate any insight on that.

提交回复
热议问题