UniDec
Universal Deconvolution of Mass and Ion Mobility Spectra
Public Member Functions | Public Attributes | List of all members
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox Class Reference

Public Member Functions

def __init__
 
def new_axes
 
def update_background (self, event)
 
def ignore (self, event)
 
def press (self, event)
 
def release (self, event)
 
def update (self)
 
def onmove (self, event)
 
def set_active (self, active)
 
def get_active (self)
 

Public Attributes

 crossoverpercent
 
 axes
 
 canvas
 
 visible
 
 cids
 
 active
 
 to_draw
 
 background
 
 onselect
 
 onmove_callback
 
 useblit
 
 minspanx
 
 minspany
 
 integrate
 
 smash
 
 validButtons
 
 spancoords
 
 eventpress
 
 eventrelease
 
 data_lims
 
 rectprops
 
 buttonDown
 
 prev
 

Detailed Description

Select a min/max range of the x axes for a matplotlib Axes

Example usage::

    from matplotlib.widgets import  RectangleSelector
    from pylab import *

    def onselect(xmin, xmax, value, ymin, ymax):
      'eclick and erelease are matplotlib events at press and release'
      print ' x,y min position : (%f, %f)' % (xmin, ymin)
      print ' x,y max position   : (%f, %f)' % (xmax, ymax)
      print ' used button   : ', eclick.button

    def toggle_selector(event):
        print ' Key pressed.'
        if event.key in ['Q', 'q'] and toggle_selector.RS.active:
            print ' RectangleSelector deactivated.'
            toggle_selector.RS.set_active(False)
        if event.key in ['A', 'a'] and not toggle_selector.RS.active:
            print ' RectangleSelector activated.'
            toggle_selector.RS.set_active(True)

    x = arange(100)/(99.0)
    y = sin(x)
    fig = figure
    axes = subplot(111)
    axes.plot(x,y)

    toggle_selector.RS = ZoomBox(axes, onselect, drawtype='line')
    connect('key_press_event', toggle_selector)
    show()

Constructor & Destructor Documentation

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.__init__ (   self,
  axes,
  onselect,
  drawtype = 'box',
  minspanx = None,
  minspany = None,
  useblit = False,
  lineprops = None,
  rectprops = None,
  onmove_callback = None,
  spancoords = 'data',
  button = None,
  data_lims = None,
  integrate = 0,
  smash = 0 
)
Create a selector in axes.  When a selection is made, clear
the span and call onselect with

  onselect(pos_1, pos_2)

and clear the drawn box/line. There pos_i are arrays of length 2
containing the x- and y-coordinate.

If minspanx is not None then events smaller than minspanx
in x direction are ignored(it's the same for y).

The rect is drawn with rectprops; default
  rectprops = dict(facecolor='red', edgecolor = 'black',
           alpha=0.5, fill=False)

The line is drawn with lineprops; default
  lineprops = dict(color='black', linestyle='-',
           linewidth = 2, alpha=0.5)

Use type if you want the mouse to draw a line, a box or nothing
between click and actual position ny setting

drawtype = 'line', drawtype='box' or drawtype = 'none'.

spancoords is one of 'data' or 'pixels'.  If 'data', minspanx
and minspanx will be interpreted in the same coordinates as
the x and y axis, if 'pixels', they are in pixels

button is a list of integers indicating which mouse buttons should
be used for rectangle selection.  You can also specify a single
integer if only a single button is desired.  Default is None, which
does not limit which button can be used.
Note, typically:
 1 = left mouse button
 2 = center mouse button (scroll wheel)
 3 = right mouse button

Member Function Documentation

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.get_active (   self)
to get status of active mode (boolean variable)
def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.ignore (   self,
  event 
)

Here is the caller graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.new_axes (   self,
  axes,
  rectprops = None 
)

Here is the call graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.onmove (   self,
  event 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.press (   self,
  event 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.release (   self,
  event 
)

Here is the call graph for this function:

Here is the caller graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.set_active (   self,
  active 
)
Use this to activate / deactivate the RectangleSelector

    from your program with an boolean variable 'active'.
def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.update (   self)

Here is the caller graph for this function:

def UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.update_background (   self,
  event 
)

Here is the caller graph for this function:

Member Data Documentation

UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.active
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.axes
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.background
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.buttonDown
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.canvas
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.cids
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.crossoverpercent
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.data_lims
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.eventpress
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.eventrelease
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.integrate
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.minspanx
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.minspany
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.onmove_callback
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.onselect
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.prev
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.rectprops
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.smash
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.spancoords
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.to_draw
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.useblit
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.validButtons
UniDec.unidec_modules.isolated_packages.ZoomBox.ZoomBox.visible

The documentation for this class was generated from the following file: