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

Can not change the color of edges #36

Closed AnnaKaisanLahti closed 2 years ago

AnnaKaisanLahti commented 2 years ago

Hi,

I can not change the color of the edges in ggVennDiagram:

ggVennDiagram(x_bac, color = "black", category.names = c("AM", "FE"), label_alpha = 0) + scale_fill_gradient(low = "pink1", high = "pink4")

This works otherwise fine, but none of the commands to modify the edges have any effect(color, lty, lwd), and I get red border for AM set and light blue for FE set, no matter the settings.

I also tried the other way and this produces red edges to both sets, no matter the options:

venn <- Venn(x_bac) data <- process_data(venn) ggplot() + geom_sf(aes(fill = count), data = venn_region(data)) + geom_sf(aes(color="black"), 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()

What am I doing wrong here?

Capture1 Capture2

gaospecial commented 2 years ago

You may use set_color to set the color of set labels, and scale_color_*() function to set the color of edges.

for example,

library(ggVennDiagram)
l = list(A=1:2,B=2:3,C=4:6,D=1:5)
ggVennDiagram(l, set_color = c("black","grey","yellow","green"))

image

ggVennDiagram(l, set_color = c("black","grey","yellow","green")) + 
    scale_color_manual(values = c("black","blue","green","yellow"))

image

If you could not reproduce the above example, please upgrade your ggVennDiagram package.

AnnaKaisanLahti commented 2 years ago

Thank you! scalecolor*() worked like a charm.