paulbrodersen / netgraph

Publication-quality network visualisations in python
GNU General Public License v3.0
660 stars 39 forks source link

Overlapping nodes Fix #89

Closed anisdismail closed 2 months ago

anisdismail commented 2 months ago

First of all, kudos on making a very neat and clean library for generating beautiful graphs in python. I have a question regarding my current implementation. I have a weighted raph of node communities, each colored by their community membership. My issue is with the text label I have for every node and its corresponding size, since some of the nodes have different sizes and therefore are overlapping with each other. This is part of the code I am using for the Graph class: Graph(G,node_labels=node_labels, node_color=node_color, node_edge_width=0, node_layout='community', node_layout_kwargs=dict(node_to_community=unique_total_nodes.set_index("src_idx")["Cluster"].to_dict()), node_label_fontdict=dict(size=7), node_size=node_sizes, edge_layout='bundled',edge_layout_kwargs=dict(k=5000), edge_width=1,edge_alpha=0.1,ax=ax Is there any way to control the way the nodes "repel" each other? Thank you!

paulbrodersen commented 2 months ago

Nodes should not overlap, if at all possible (i.e. if there is enough space given the node sizes). In the community layout, nodes are grouped together within a community-reserved sub-region of the canvas, so this layout runs out of space much quicker than others. So this may be the issue, but it is difficult to know without access to the data. Could you

  1. show what the figure currently looks like, and
  2. upload the data required to construct the graph?

The latter could be done in two CSV files:

a) The edge list (columns: source, target), and b) the node properties (columns: node ID, node label, cluster, node size).

paulbrodersen commented 2 months ago

Hey, I haven't heard from you in a while. I am assuming you found a workaround. If not, feel free to re-open.