Le jeudi 07 juin 2012 à 14:07 +0100, David Craig a écrit :
> Hi,
> I trying to define an area in a pcolor plot (several plots) using the 
> 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've tried the following but it requires a double click at each point, 
> which I would like to avoid as it duplicates points
> 
> |x = randn(10,10)
> imshow(x)
> 
> button = False
> points = []
> while button == False:
>      points.append(ginput(1))
>      button = waitforbuttonpress()
> |
> 
> Anyone know a better way to go about this??
> thanks
> Dave

ginput has a way to do it. From docs:
        If n is zero or negative, accumulate clicks until a middle click
        (or potentially both mouse buttons at once) terminates the
        input.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ginput
Pressing [enter] also terminates the points acquisition.
-- 
Fabrice Silva <si...@lma.cnrs-mrs.fr>
LMA UPR CNRS 7051


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to