diff options
Diffstat (limited to 'plot.py')
-rw-r--r-- | plot.py | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -61,10 +61,17 @@ def find_boundary_curves(swis, x, y): swis = load("dataset") -x = 16.61 -y = 8600 -segments = find_boundary_curves(swis, x, y) -plot.plot([x], [y], "rx") -for index, data, i, j in segments: - plot.plot([x[0] for x in data], [x[1] for x in data], ".") + +def onclick(event): + if event.button != 1: + return + plot.clf() + segments = find_boundary_curves(swis, event.xdata, event.ydata) + plot.plot([event.xdata], [event.ydata], "rx") + for index, data, i, j in segments: + plot.plot([x[0] for x in data], [x[1] for x in data], ".", label=index) + plot.show() + +fig, _ = plot.subplots() +fig.canvas.mpl_connect('button_press_event', onclick) plot.show() |