gaospecial / ggVennDiagram

A 'ggplot2' implement of Venn Diagram.
https://gaospecial.github.io/ggVennDiagram/
GNU General Public License v3.0
282 stars 38 forks source link

Rotate the whole venn diagram #34

Closed hjsbio closed 2 years ago

hjsbio commented 3 years ago

Dear authors,

Is their any methods to rotate the whole venn diagram. For example, the default 3-sets venn is like below, image

so how can we make it like this: image

gaospecial commented 3 years ago

Using a different shape in ggVennDiagram is possible as you know how to setup a novel shapes for it, see https://gaospecial.github.io/ggVennDiagram/articles/using-new-shapes.html for more information.

By the way, I have changed the default shapes stored in ggVennDiagram's system data, therefore, you may install the developing version and run:

remotes::install_github("gaospecial/ggVennDiagram")

library(ggVennDiagram)
library(ggplot2)
l = list(A=1:3,B=2:4,C=3:6)
data = process_data(Venn(l), shape_id == "301f")
ggplot() +
  geom_sf(aes(fill = count), data = venn_region(data)) +
  geom_sf(aes(color = id), data = venn_setedge(data), show.legend = FALSE) +
  geom_sf_text(aes(label = name), data = venn_setlabel(data)) +
  geom_sf_label(aes(label = count), data = venn_region(data)) +
  theme_void()

image

hjsbio commented 3 years ago

Using a different shape in ggVennDiagram is possible as you know how to setup a novel shapes for it, see https://gaospecial.github.io/ggVennDiagram/articles/using-new-shapes.html for more information.

By the way, I have changed the default shapes stored in ggVennDiagram's system data, therefore, you may install the developing version and run:

remotes::install_github("gaospecial/ggVennDiagram")

library(ggVennDiagram)
library(ggplot2)
l = list(A=1:3,B=2:4,C=3:6)
data = process_data(Venn(l), shape_id == "301f")
ggplot() +
  geom_sf(aes(fill = count), data = venn_region(data)) +
  geom_sf(aes(color = id), data = venn_setedge(data), show.legend = FALSE) +
  geom_sf_text(aes(label = name), data = venn_setlabel(data)) +
  geom_sf_label(aes(label = count), data = venn_region(data)) +
  theme_void()

image

It works, thanks for your quick reply. Terrific.