briatte / ggnet

Network visualization with ggplot2
https://briatte.github.io/ggnet/
194 stars 33 forks source link

Legend for edge.color #44

Closed ConGibbs10 closed 3 years ago

ConGibbs10 commented 3 years ago

When I input a vector of color values for the edges, I cannot generate a legend which tells the reader what the colored edges represent. This would be a great enhancement.

briatte commented 3 years ago

Hi @ConGibbs10 — Indeed, if you pass colours straight to the edges, you cannot label them. For that, you want to pass factors as edge attributes, and then colour (and label) them. I believe the vignette explains how to do that.