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

using full plot area #17

Open
AmelZulji opened this issue Mar 18, 2021 · 1 comment
Open

using full plot area #17

AmelZulji opened this issue Mar 18, 2021 · 1 comment

Comments

@AmelZulji
Copy link

Dear @yanlinlin82,

Thank you for the package!

I have a minor question regarding the plot size. Namely, if you try to align couple of plots using i.e. patchwork it seems like the venn diagrams are not occupying the full plot area.

Following code:

library(ggvenn)
library(patchwork)

a <- list(`Set 1` = c(1, 3, 5, 7, 9),
          `Set 2` = c(1, 5, 9, 13),
          `Set 3` = c(1, 2, 8, 9),
          `Set 4` = c(6, 7, 10, 12))

p1 <- ggvenn(a, c("Set 1", "Set 2"))

p2 <- iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width)) + geom_point()

p1 / p2

produces this figure from which it seems like the venn diagrams are not in the full plot area:

Screen Shot 2021-03-18 at 18 07 57

I would expect the plots to occupy full ploting area, like in the example bellow:

p2 / p2

Screen Shot 2021-03-18 at 18 10 56

I tried following:

p1 <- ggvenn(a, c("Set 1", "Set 2")) + theme(plot.margin = unit(c(0,0,0,0), "cm"))

p1/p2

but seems like it has no effect.

Do you have any suggestion how to expend ggvens to occupy full plot area?

Thank you in advance
Amel

@yanlinlin82
Copy link
Owner

@AmelZulji I am so sorry for the quite late reply!

I checked the source code and found some hard-code about the coordinates. Before I fixed this in a better way, here goes a quick workaround:

p1 <- p1 + scale_y_continuous(limits = c(-1, 1.5))
p1 / p2

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

2 participants