R: ggtern无法使用,与新的ggplot2不兼容。

3

我正在尝试使用ggtern包来绘制一些图形。它曾经在ggplot2上运行,但现在不起作用并破坏了ggplot2。

当我运行以下内容时:

library(ggplot2)
qplot(1,2)
library(ggtern)
qplot(3,4)

df = data.frame(x = runif(50),
                y = runif(50),
                z = runif(50),
                Value = runif(50,1,10),
                Group = as.factor(round(runif(50,1,2))))
ggtern(data=df,aes(x,y,z,color=Group)) +
  theme_rgbw() +
  geom_point() + geom_path() +
  labs(x="X",y="Y",z="Z",title="Title")

qplot(1,2) 可以正常工作,library(ggtern) 给了我这个(可能与问题有关):

Attaching package: ‘ggtern’

The following objects are masked from ‘package:ggplot2’:

    %+%, %+replace%, aes, calc_element, Geom, geom_segment, ggplot_build,
    ggplot_gtable, ggsave, theme, theme_bw, theme_classic, theme_get, theme_gray,
    theme_grey, theme_minimal, theme_set, theme_update

qplot(3,4)失败,显示如下:

Error in FUN(X[[i]], ...) : attempt to apply non-function

如果我将其注释掉,然后运行到ggtern(...这一步,会出现这种情况:

Error in coord_tern() : could not find function "coord"

显然出了问题。我应该从哪里开始找出问题?这个函数coord是什么,为什么它消失了?

1
ggplot2最近进行了重大更新。依赖包需要适应ggplot2的内部更改。看起来ggtern掩盖了许多基本的ggplot2函数。 - Roland
1
据我从 Hadley 的评论中读到的,gtern 现在已经因为新包而失效。维护者显然不在身边进行必要的更改。 - Mike Wise
3个回答

1

是的,ggtern 2.0.1现在已经发布,几天前在CRAN上发布,完全重写了该软件包以与ggplot2 2.0.0兼容。 ggtern 2.0.X中新功能的摘要可以在此处here找到:

以下是您的代码在新软件包下生成的结果:

solution


2
问题于2016年3月9日重新出现。绘图失败并显示与原始帖子相同的错误,如CRAN软件包检查结果ftp://r-project.org/pub/R/web/checks/check_results_ggtern.html中所示。 - Ryan

1

0

引用开发者的电子邮件:

我刚刚发布了新的ggtern 2.0.1版本,与ggplot2 2.0兼容。

现在应该没问题了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接