I was playing around with matplotlib, created a plot that allows users to add nodes (axis is set off as it's going to be used for graph data structuer purposes, hence don't want the y-x axis, is there another way to hide them as well?).
Basically the program below allows person press the 'n' button, and then can click on any point on the plot and a small circular marker will appear.
I have two questions:
1) You will notice that during the first 2 marker inputs, the plot rescales it self. I don't really know why that's happening, any idea?
2) Is it possible to disallow users of creating to marker points ontop of each other, so that no markers will overlap (even if the edges)?
from pylab import *
from matplotlib.widgets import *
fig = plt.figure()
ax = fig.add_subplot(111)
cid = None
"""docstring for onClick"""
ax.plot([event.xdata], [event.ydata], 'bo', picker=5, markersize=15)
"""docstring for onPick"""
artist = event.artist
"""docstring for press"""
cid = fig.canvas.mpl_connect('button_press_event',onClick)