Servus
Servus

Reputation: 392

ggtern breaks ggplot2 and produces plots without axis labels etc

I noticed that, since ggplot2 released their new version (3.3.0), I can no longer use the package ggtern, as it completely breaks all my plots produced with ggplot2.

library(ggplot2)
df <- data.frame("x" = c(1,2), "y" = c(2,1))
ggplot(df, aes(x,y)) + geom_point()

This produces a normal plot: normal ggplot

However, when i load ggtern, I get the following:

library(ggtern)
ggplot(df, aes(x,y)) + geom_point()

No axes etc.: ggplot after loading ggtern

It also stays this way when i detach ggtern, so I have to restart R to produce normal plots again.

A workaround is to downgrade ggplot2 to an older version (i.e. version 3.2.1), however, this comes with other downsides.

Is there another workaround where I can use the current ggplot2 Version and ggtern?

Upvotes: 4

Views: 585

Answers (1)

wdkrnls
wdkrnls

Reputation: 4702

Here is a work-around I found. I save my plot into variable p. Then I call ggplot2:::plot.ggplot(p). That at least makes axis text show up for me.

Upvotes: 0

Related Questions