Interactive masking

I am interested in making an 'interactive mask.' That is, I am creating a model of estuarine flow, where the grid is rectangular, and part of the domain will be land, not included in the simulation through a mask. I would like to be able to modify this mask using a tool that will allow me to click cells on and off.

I can think of a few ways to do this, but I thought I would ask y'all first. A rough outline of the code would be:

1. pcolor the grid
2. Catch clicks in the figure, and determine which cell is clicked.
3. Toggle the masking of that cell, and re-draw the figure

Has anybody done this?

Any ideas about any of the parts? I think I can handle part 1. I'm worried part 3 might be inefficient.

-Rob

···

----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331

I have looked in the User's Guide for matplotlib, but couldn't find anything on setting the aspect ratio. Can anyone point me to some info online? I will continue to look. Thanks.

···

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora@...1125...

Louis Pecora wrote:

I have looked in the User's Guide for matplotlib, but couldn't find anything on setting the aspect ratio. Can anyone point me to some info online? I will continue to look. Thanks.

Each axes object has the following method (with only the docstring shown here):

     def set_aspect(self, aspect, adjustable=None, anchor=None):
         """
         aspect:
            'auto' - automatic; fill position rectangle with data
            'normal' - same as 'auto'; deprecated
            'equal' - same scaling from data to plot units for x and y
             num - a circle will be stretched such that the height
                        is num times the width. aspect=1 is the same as
                        aspect='equal'.

         adjustable:
             'box' - change physical size of axes
             'datalim' - change xlim or ylim

         anchor:
             'C' - centered
             'SW' - lower left corner
             'S' - middle of bottom edge
             'SE' - lower right corner
                  etc.

         ACCEPTS: ['auto' | 'equal' | aspect_ratio]
         """

Is this what you are looking for?

Eric

Hi,
I have done this with pygist (see attached snippet), but not with
matplotlib (yet) as it is a bit to slow for big datasets.
I believe it should be relatively easy to implement a similar mouse
handling loop for
matplotlib, someone else can probably fill in with a better solution.
if you use pcolormesh instead of pcolor in a similar matplotlib
implementation the performance will be reasonable.

Helge

edit.py (4 KB)

···

On 9/8/06, Rob Hetland <hetland@...760...> wrote:

I am interested in making an 'interactive mask.' That is, I am
creating a model of estuarine flow, where the grid is rectangular,
and part of the domain will be land, not included in the simulation
through a mask. I would like to be able to modify this mask using a
tool that will allow me to click cells on and off.

I can think of a few ways to do this, but I thought I would ask y'all
first. A rough outline of the code would be:

1. pcolor the grid
2. Catch clicks in the figure, and determine which cell is clicked.
3. Toggle the masking of that cell, and re-draw the figure

Has anybody done this?

Any ideas about any of the parts? I think I can handle part 1. I'm
worried part 3 might be inefficient.

-Rob

----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users