JohnCoene / sigmajs

Σ sigma.js for R
http://sigmajs.john-coene.com
Other
72 stars 7 forks source link

Providing each node and edge with a specific colour via hex codes #23

Closed jwscot closed 2 years ago

jwscot commented 2 years ago

Hi John,

Is it possible to provide each node and edge with a specific colour via hex codes?

Cheers,

Jamie

JohnCoene commented 2 years ago

Yes it's shown here:. https://sigmajs.john-coene.com/reference/graph.html

jwscot commented 2 years ago

Apologies but does that not only provide a way to give all nodes the same colour? I'd like to give each node a unique colour.

JohnCoene commented 2 years ago

Yes, in the examples.

nodes <- sg_make_nodes()
edges <- sg_make_edges(nodes)

sg <- sigmajs() %>%
  sg_nodes(nodes, id, label, size, color) %>%
  sg_edges(edges, id, source, target)
jwscot commented 2 years ago

Ok, thanks.