yanlinlin82 / ggvenn

Venn Diagram by ggplot2, with really easy-to-use API.
Other
167 stars 25 forks source link

"stroke_color" Multiple colors: is it possible? #49

Closed Franelizabethgalvez closed 1 month ago

Franelizabethgalvez commented 1 month ago

I would like to know if it is possible to define multiple colors for the stroke_color or if it is only possible to define one color. This is my code:

a <- list(set1 = data[1:9, 2], set2 = data[1:3308, 3], set3 = data[1:2282, 4])

ggvenn(a, fill_color = c("seagreen2","orange1","gold"), fill_alpha= 0.5, stroke_size= 0.5, set_name_color=c("seagreen2","orange1","gold"), stroke_color=c("seagreen2","orange1","gold"), set_name_size=7,text_color="black", text_size=4.5, show_stats="c")

And this is the error I'm getting:

Error in geom_polygon(): ! Problem while setting up geom aesthetics. Error occurred in the 2nd layer. Caused by error in check_aesthetics(): ! Aesthetics must be either length 1 or the same as the data (300). ✖ Fix the following mappings: colour. Run rlang::last_trace() to see where the error occurred.

the code only runs with stroke_color="grey"

Then I conclude that it is not possible to define more than one color. I would be grateful if someone could confirm this, or maybe there is another way to do this. UV_Venn_SET_UP.txt

Thank you very much!! ;)

yanlinlin82 commented 1 month ago

So far, it is not possible to specify distinct colors for the sets because the stroke color (as well as alpha, size, and linetype) is hard-coded here. If this feature is useful, I think we could consider adding it to the ggvenn package in future.

yanlinlin82 commented 1 month ago

@Franelizabethgalvez Here goes a workaround in another issue (#33)

Franelizabethgalvez commented 1 month ago

Thanks @yanlinlin82! Yes, totally agree; please consider adding multiple colors to stroke_color ;)