1

I have plotted a large graph with networkx and want to see the names of each vertex, unfortunately there are too many to read easily. Looking around I have found implementations of datacursormode in matplotlib but have been unable to make them work as networkx.draw does not return objects. Here's the original question

Is there a matplotlib equivalent of MATLAB's datacursormode?

Many Thanks

edit: I can get it to work by editting http://www.scipy.org/Cookbook/Matplotlib/Interactive_Plotting but would ideally have some idea which vertex I selected, so that I can change the colour of adjacent edges.

Community
  • 1
  • 1

1 Answers1

1

You can usually retrieve the artist in question using the following command in the callback function:

thisline = event.artist

And from there check things like labels (thisline.get_label()) or whatever other artist properties are of interest to you.

This, however, assumes that have some labeling system in place for the vertices already, or another way of determining which virtex is which. If you don't, that's another story altogether.

stanri
  • 2,922
  • 3
  • 25
  • 43