Skip to content

Commit 77a4845

Browse files
committed
update: venn plot
1 parent c1f7c7c commit 77a4845

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

‎api/code/3_plot_venn_m.R‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,27 @@ plot_and_save_venn <- function(gene_lists, reg) {
1919
install_and_load("ggVennDiagram")
2020

2121
# Generate the Venn diagram
22-
venn_plot <- ggVennDiagram(gene_lists, label = "count")
22+
venn_plot <- ggVennDiagram(
23+
gene_lists,
24+
label = "count", # show counts
25+
label_geom = "label", # draw counts in boxes (like pic 2)
26+
label_alpha = 0.85, # box opacity
27+
label_fill = "grey85", # box color behind numbers
28+
label_color = "grey10", # text color
29+
label_size = 3.6, # text size
30+
edge_size = 0.8 # circle edge thickness
31+
) +
32+
scale_fill_gradient(low = "#c6dbef", high = "#08306b", name = "count") +
33+
theme_void() + # clean white background (no dark bg)
34+
theme(
35+
legend.position = "right",
36+
legend.title = element_text(size = 10),
37+
legend.text = element_text(size = 9)
38+
)
2339

2440
# Save the plot in different formats with reg in the filename
2541
ggsave(paste0("figures/venn_diagram_", reg, ".png"), plot = venn_plot, width = 8, height = 6)
2642
ggsave(paste0("figures/venn_diagram_", reg, ".pdf"), plot = venn_plot, width = 8, height = 6)
27-
ggsave(paste0("figures/venn_diagram_", reg, ".tiff"), plot = venn_plot, width = 8, height = 6)
28-
ggsave(paste0("figures/venn_diagram_", reg, ".jpg"), plot = venn_plot, width = 8, height = 6)
43+
#ggsave(paste0("figures/venn_diagram_", reg, ".tiff"), plot = venn_plot, width = 8, height = 6)
44+
#ggsave(paste0("figures/venn_diagram_", reg, ".jpg"), plot = venn_plot, width = 8, height = 6)
2945
}

0 commit comments

Comments
 (0)