shahinrostami / plotapi

Engaging visualisations, made easy.
https://plotapi.com
MIT License
267 stars 17 forks source link

Nodes without connections #19

Closed fiedl closed 3 years ago

fiedl commented 3 years ago

Scenario

I'm adding a node without connection to the chord diagram.

# python

from chord import Chord

matrix = [
  [0, 1, 0],
  [2, 0, 0],
  [0, 0, 0]
]

names = ["Foo", "Bar", "Without connection"]

Chord(matrix, names).show()

In the above example, the node without connection corresponds to the third names entry and to the last column and row in the matrix containing only zeros.

Expected Behaviour

The chord diagram shows the labels of all nodes and the connections of the connected nodes. It does not show connections of the unconnected node.

Observed Behaviour

When adding nodes without connection, the chord diagram does not show any labels or connections.

Bildschirmfoto 2020-10-12 um 14 23 00

Environment

nteract 0.25.1 Python 3.7.6 chord 0.3.0

shahinrostami commented 3 years ago

Hello @fiedl

chord currently doesn't support items without any quantities at all (no occurrence or co-occurrence). What is your desired output for the third item - a thin line indicating with the corresponding label? This sounds like a possible feature in future. Are you using chord or chord pro?

At the moment I'm working on an update that contains better error logging, e.g. in this case the user would be informed about the missing data.

fiedl commented 3 years ago

Thank you for the quick reply! I'm using the free chord, but I would be willing to pay for chord pro if necessary — despite my work being scientific and open source.

Indicating the unconnected nodes with zero-width line would be fine. Even better for my use case would be to set the width (or percentage of the circle) for each node manually. This would allow me to have the node size indicate their overall importance/share/percentage regardless of their connections to other nodes.

shahinrostami commented 3 years ago

Happy to hear you're using chord for scientific work!

I asked because chord is on a feature freeze right now, with the upcoming update to be on better error messages. chord pro is still getting new features, with requests being accepted by chord pro owners too! It's only a small cost but it seems to be enough to fund some continued work on the project. You can check out chord pro here https://datacrayon.com/shop/product/chord-pro/!

Labelling connectionless items should be possible! I'm on discord here https://discord.com/invite/nsezsyb if you want to drop by.

shahinrostami commented 3 years ago

Hello @fiedl

I've pushed a quick solution to this in chord pro (https://datacrayon.com/shop/product/chord-pro/!), that is, some support for unconnected nodes.

It requires an update to chord 0.3.1 (Python) which has disabled wrap_labels by default.

Here is the output from your example code above:

Screenshot 2020-11-03 at 19 16 33
fiedl commented 3 years ago

Thank you