Closed darryl34 closed 8 months ago
I was thinking maybe a warning could be issued somehow if one sets the node_size to a small value without setting node_edge_width to zero.
Great suggestion. There are additional complications (the node_edge_color
might be the same as the node_color
in which case Netgraph probably should not raise a warning) but I like idea. I will think about where and when to raise the warning, and incorporate it in the next release.
Added the following check that results in a warning if the node radius is smaller than the node edge width and the color of the node face is distinct from the the color of the node edge:
for node in self.nodes:
if (node_size[node] < node_edge_width[node]) & (node_color[node] != node_edge_color[node]):
msg = f"The border around the node {node} is broader than its radius."
msg += f" The node will mostly have the color of the border ({node_edge_color[node]}), even though a different face color was specified ({node_color[node]})."
msg += f" To address this issue, reduce the value given for `node_edge_width`."
warnings.warn(msg)
Basically when
node_size
is set to a small value, butnode_edge_width
is not specified, the node edge fills the entire node, giving the false impression that there is an issue with setting the node colours.Using the example given for community node layout/bundled edges found here, by simply removing the node_edge_width param, and setting node_size to 0.1.
Increasing the node sizes correctly shows the different colours as expected.![a662e7b5-d868-4977-83d0-f283349da14e](https://github.com/paulbrodersen/netgraph/assets/47094946/7f482841-6dff-422c-83bb-6851e7ce5670)
Don't think this is a bug but raising this issue here because I was working on a graph with a large number of nodes and for the longest time I thought the issue was with
node_color
. I was thinking maybe a warning could be issued somehow if one sets thenode_size
to a small value without settingnode_edge_width
to zero.