pnnl / HyperNetX

Python package for hypergraph analysis and visualization.
https://hypernetx.readthedocs.io
Other
539 stars 92 forks source link

Overlapping node labels #17

Closed epideveloper closed 4 years ago

epideveloper commented 4 years ago

When drawing hypergraphs using the rubber band layout, node labels often overlap. This is especially prevalent when using longer strings as node labels; however, this problem also often occurs with very short labels as well. Due to the overlap, many labels are unreadable. Are there any settings within HyperNetX or Matplotlib to correct this? If not, are there any known workarounds? Thanks!

brendapraggastis commented 4 years ago

We have this problem too and find it easiest to resize the hypergraph using matplotlib:

fig,ax = plt.subplots(1,1,figsize=(15,15))
hnx.draw(H)

The font size remains constant so this lets things spread out.

You can also control the size of the fonts by adjusting the kwargs for edge_labels. There are some examples using kwargs in the Tutorials/Tutorial 2 - Visualization Methods.ipynb notebook.

epideveloper commented 4 years ago

I tried increasing the size of the figure but there was still label overlap. Also, there is a limit to how large the figures can be if you want to include them in a manuscript using a standard 8.5x11 paper size.