summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-08-26 23:09:12 +0200
committerAki <please@ignore.pl>2022-08-26 23:09:12 +0200
commitc5f30af34889ec6ff59197f617ee9835bf537fac (patch)
tree66e173de1fd7f1f0459b33f829120a02e572561b
parentbeb3b7582ee8ceb0ea8af3e1747dbce2bf60bfb0 (diff)
downloadszilagyi-c5f30af34889ec6ff59197f617ee9835bf537fac.zip
szilagyi-c5f30af34889ec6ff59197f617ee9835bf537fac.tar.gz
szilagyi-c5f30af34889ec6ff59197f617ee9835bf537fac.tar.bz2
The example plot is a bit interactive now
-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()