Gimelist
Gimelist

Reputation: 823

R: ggtern does not work, broken with new ggplot2

I'm trying to use the ggtern package to plot some plots. It used to run on ggplot2, but now it doesn't work and breaks ggplot2.

When I run the following:

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) works just fine, library(ggtern) gives me this (which may or may not be related to the problem):

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) fails with this:

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

And if I comment it out and it reaches the ggtern(... I get this:

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

Obviously, something is wrong. Where do I start looking for what's wrong? What's this function coord and why is it gone?

Upvotes: 3

Views: 1469

Answers (3)

Nicholas Hamilton
Nicholas Hamilton

Reputation: 10526

Yep, ggtern 2.0.1 is now available, published on CRAN a couple of days ago after completely re-writing the package to be compatible withggplot2 2.0.0. A summary of the new functionality in ggtern 2.0.X can be found here:

Here is what your code produces under the new package:

solution

Upvotes: 1

Gimelist
Gimelist

Reputation: 823

Quoting an email from the developer:

I have just released the new ggtern 2.0.1 version, compatible with ggplot2 2.0.

Should be ok now.

Upvotes: 0

D Tuohey
D Tuohey

Reputation: 11

I ran into the same problem with ggtern faulting. My work around was downloading and installing the 1.0.1 version of ggplot2. Archived versions can be found at "cran.r-project.org" website at https://cran.r-project.org/src/contrib/Archive

Upvotes: 1

Related Questions