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

Add custom themes to ggVennDiagram when force_upset = TRUE #68

Open
sgarciah12 opened this issue Apr 10, 2024 · 2 comments
Open

Add custom themes to ggVennDiagram when force_upset = TRUE #68

sgarciah12 opened this issue Apr 10, 2024 · 2 comments

Comments

@sgarciah12
Copy link

Dear @gaospecial,

First, thanks for developing this amazing tool! ggVennDiagram has helped me make lots of figures until now.

I just found a little issue: ggVennDiagram accepts full customization using the ggplot2 grammar but when I try with force_upset = T, then it no longer works.

For example:

X = list(A = c(1,2,3,4), B = c(2,3,4,5), C = c(3,4,5,6))
ggVennDiagram(X) + theme(panel.background = element_rect(fill = "red"))

Which returns the following graph with the background in red:
image

But, while I can do the same in ggVennDiagram with force_upset = T:

X = list(A = c(1,2,3,4), B = c(2,3,4,5), C = c(3,4,5,6))
ggVennDiagram(X, force_upset = T)

Which returns:
image

If I now try to change the graph background (or any other theme property using the ggplot2 sintax) it returns:

ggVennDiagram(X, force_upset = T) + theme(panel.background = element_rect(fill = "red"))

NULL

Would it be possible to fix that so that customization of upset plots is easier following ggplot2's grammar? Thank you very much!

@gaospecial
Copy link
Owner

I am sorry, the upset plot is a complex graph type which can not be plot by ggplot2 directly. So it is not a ggplot class object, therefore, no longer modification can be made with theme() and other ggplot2 functions. If you want to customize the upset plot, please export the graph as a pptx or pdf file.

For example, you may export this graph to Powerpoint format.

# need export package
library(export)
ggVenndiagram()
export::graph2ppt(file = "venn.pptx")

and then edit the background by hand.

@sgarciah12
Copy link
Author

Dear @gaospecial ,

Thanks for your quick answer. I understand now, I did not know that it was not a ggplot2 object like ggVenndiagram().

I actually want to customize the size of the labels of the three graphs, they become too small if the upset plot is too big.

Is it possible then to add two options to control the size of the axis tick labels like the ones already available in the function?

I see there is already an option top.bar.numbers.size, so something like two/three new options top.bar.label.size intersection.matrix.label.size and set.label.size? I guess they would need to be included in the theme functions of upset_plot.

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