briatte / ggnetwork

Geoms to plot networks with ggplot2
https://briatte.github.io/ggnetwork/
146 stars 28 forks source link

Right way to include user-defined palette for ggnetwork nodes #70

Open peranti opened 3 years ago

peranti commented 3 years ago

How can the palette argument works for the ggnet function can be reproduced while working with the ggnetwork package?

ggnet2(netBio, size = "degree", size.cut = 10, node.color = "Source", 
       palette = c("cat1" = "#4daf4a", "cat2" = "#377eb8", "cat3" = "#e41a1c"),
       alpha = 0.75, label = "ID", 
       edge.size = 1, edge.color = "grey", edge.alpha = 0.5)

I am using the above command and it works fine. I had an issue with the labels overlapping with one another and based on your advice here, I am shifting to ggnetwork environment.

briatte commented 1 year ago

Hi @peranti — Very late answer, sincere apologies for that. ggnetwork supports ggplot2 scales, so using scale_*_manual should work.