thomasp85 / patchwork

The Composer of ggplots
https://patchwork.data-imaginist.com
Other
2.48k stars 163 forks source link

Error: Don't know how to add o to a plot #42

Closed peterch405 closed 6 years ago

peterch405 commented 6 years ago

When ggtern is loaded

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))
p1 + p2

Produces: Error: Don't know how to add o to a plot

thomasp85 commented 6 years ago

ggtern overwrites key aspects of ggplot2 and cannot be expected to play nice with other extensions. While I will not rule it out, I have no plans on supporting it for these reasons

KarenSchleeweis commented 6 years ago

I don't have ggtern and I get the same error...

thomasp85 commented 6 years ago

Can you provide a reproducible example?

jinqiangyan commented 6 years ago

hi your code 'ggplot(mtcars)' is duplicated. In other ways, p1 and p2 are two graphs as your code. You should code like this: p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) p2 <- p1+ geom_boxplot(aes(gear, disp, group = gear)) p1 + p2

It works!

knowah commented 4 years ago

For others coming across this issue, it was a conflict with the ggbio package which I had previously loaded. Running unloadNamespace("ggbio") eliminated this error.

jayoung commented 4 years ago

thanks, @knowah - just had the same problem with ggbio: glad to find this.

rcorty commented 4 years ago

ggtern overwrites key aspects of ggplot2 and cannot be expected to play nice with other extensions. While I will not rule it out, I have no plans on supporting it for these reasons

Could/shouldggtern be changed so as not to overwrite these things? Or is that fundamental/necessary to its function?

claireatati commented 2 years ago

thank you so much @knowah . I ran into this problem in the middle of a test so much appreciated.