python-igraph icon indicating copy to clipboard operation
python-igraph copied to clipboard

Plotting: multiple self-loops on a vertex are plotted on top of each other

Open szhorvat opened this issue 5 years ago • 8 comments

When a vertex has multiple self-loops, they are plotted on top of each other. The graphs 0-0 and 0-0, 0-0 are not visually distinguishable when plotted.

These two graphs look the same:

plot(Graph([(0,0),(0,0)]))
plot(Graph([(0,0)]))

Related: https://github.com/igraph/rigraph/issues/407

szhorvat avatar Aug 04 '20 09:08 szhorvat

I realize this is not easy. For some inspiration, Mathematica visualizes these like this:

image

As you can see, a nice solution will consider not only other self loops, but also the position of other non-loop edges.

szhorvat avatar Aug 04 '20 09:08 szhorvat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 03 '20 11:10 stale[bot]

Is this still present in the matplotlib interface?

iosonofabio avatar Apr 19 '21 22:04 iosonofabio

The Matplotlib backend seems to be better in handling multiple self-loops; just tested this now in Google Colab.

ntamas avatar Nov 23 '21 08:11 ntamas

Is this still present in the matplotlib interface?

Yes, here's an example:

ig.plot(ig.Graph.Formula('a-b-c-c-c-c-a-b', simplify=False))
image

szhorvat avatar Dec 12 '21 09:12 szhorvat

Is this the develop branch? If not please test with that

iosonofabio avatar Dec 12 '21 10:12 iosonofabio

Yes, it is with the latest develop branch.

Should this work? I vaguely remembered that you fixed this, so I was actually surprised to see that it didn't work.

szhorvat avatar Dec 12 '21 10:12 szhorvat

@iosonofabio I remembered correctly, you did fix it. It works in the released version, but it does not work on develop. Here's what I get with 0.9.8:

image
ig.plot(ig.Graph.Formula('a-b-c-c-c-c-a-b', simplify=False), target=plt.axes())

szhorvat avatar Dec 12 '21 10:12 szhorvat