summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plot.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/plot.py b/plot.py
index 6ba676e..c691d0f 100644
--- a/plot.py
+++ b/plot.py
@@ -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()