Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with ggarrange and grid.arrange? #36

Closed
NataliHB opened this issue Dec 20, 2021 · 5 comments
Closed

Incompatible with ggarrange and grid.arrange? #36

NataliHB opened this issue Dec 20, 2021 · 5 comments

Comments

@NataliHB
Copy link

Hi,

thank you for this very useful package, I was wondering if ggbreak is compatible with ggarrange and grid.arrange?

When I plot the graphs individually it works like a charm but when I try to put them together in a panel the breaks are not maintained, a fix for that will be very helpful.

Cheers,
Natali

@xiangpin
Copy link
Member

Please add print for the object generated by scale_ functions of ggbreak if using grid.arrange.

library(ggbreak)
library(ggplot2)
set.seed(2019-01-19)
d <- data.frame(
            x = 1:20,
            y = c(rnorm(5) + 4, rnorm(5) + 20, rnorm(5) + 5, rnorm(5) + 22)
        )
p <- ggplot(d, aes(x, y)) + geom_col()
x1 <- p+scale_y_break(c(7, 17 ))
library(gridExtra)
grid.arrange(print(x1), print(x1), ncol=2)

xx

Or you can use plot_list of aplot to do this. You can refer to this.

@NataliHB
Copy link
Author

Many thanks, it worked perfectly!

@n-dempe
Copy link

n-dempe commented Aug 29, 2022

Sorry but I can't use common.legend = TRUE anymore
after using print(). Do you know why?

e.g.:
ggarrange(print(A), print(A), print(A), print(A), print(A), print(A),
ncol = 3, nrow = 2, common.legend = TRUE)

@GuangchuangYu
Copy link
Member

maybe you can try aplot::plot_list().

@n-dempe
Copy link

n-dempe commented Sep 6, 2022

Thanks for the advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants