I need to define an area in a plot(s) using the matplotlib function ginput(). However since it is an irregular shape and will be different in each plot so I cant define how many points there will be before hand, i.e.
x = randn(10,10)
imshow(x)
n = I don't know yet
points = ginput(n)
Anyone know how to go about this??
thanks
Dave
From the docs, i.e.
help(ginput),We can set
n=0to have ginput wait for a mouse middle click instead of a set number of points.Bonus: setting
timeout=0stops ginput from quitting after the default 30s. I find this annoying for complex plots.Example code: