STY: Rename parameters for clarity

This commit is contained in:
Tony S Yu
2012-12-13 17:26:37 -05:00
parent 6fee0fbcfe
commit 70461b4bc9
2 changed files with 13 additions and 9 deletions
+9 -4
View File
@@ -23,6 +23,11 @@ class LineTool(CanvasToolBase):
Function called whenever the control handle is released.
on_enter : function
Function called whenever the "enter" key is pressed.
maxdist : float
Maximum pixel distance allowed when selecting control handle.
line_props : dict
Properties for :class:`matplotlib.patches.Rectangle`. This class
redefines defaults in :class:`matplotlib.widgets.RectangleSelector`.
Attributes
----------
@@ -30,12 +35,12 @@ class LineTool(CanvasToolBase):
End points of line ((x1, y1), (x2, y2)).
"""
def __init__(self, ax, x, y, on_move=None, on_release=None, on_enter=None,
maxdist=10, lineprops=None):
maxdist=10, line_props=None):
super(LineTool, self).__init__(ax, on_move=on_move, on_enter=on_enter,
on_release=on_release)
props = dict(color='r', linewidth=1, alpha=0.4, solid_capstyle='butt')
props.update(lineprops if lineprops is not None else {})
props.update(line_props if line_props is not None else {})
self.linewidth = props['linewidth']
self.maxdist = maxdist
self._active_pt = None
@@ -102,13 +107,13 @@ class LineTool(CanvasToolBase):
class ThickLineTool(LineTool):
def __init__(self, ax, x, y, on_move=None, on_enter=None, on_release=None,
maxdist=10, lineprops=None):
maxdist=10, line_props=None):
super(ThickLineTool, self).__init__(ax, x, y,
on_move=on_move,
on_enter=on_enter,
on_release=on_release,
maxdist=maxdist,
lineprops=lineprops)
line_props=line_props)
self.connect_event('scroll_event', self.on_scroll)
self.connect_event('key_press_event', self.on_key_press)
+4 -5
View File
@@ -27,9 +27,8 @@ class RectangleTool(mwidgets.RectangleSelector, CanvasToolBase):
on_enter : function
Function called whenever the "enter" key is pressed.
maxdist : float
Maximum distance in pixels for selection of a control handle
(i.e. corner or edge) handle.
rectprops : dict
Maximum pixel distance allowed when selecting control handle.
rect_props : dict
Properties for :class:`matplotlib.patches.Rectangle`. This class
redefines defaults in :class:`matplotlib.widgets.RectangleSelector`.
@@ -40,12 +39,12 @@ class RectangleTool(mwidgets.RectangleSelector, CanvasToolBase):
"""
def __init__(self, ax, on_move=None, on_release=None, on_enter=None,
maxdist=10, rectprops=None):
maxdist=10, rect_props=None):
CanvasToolBase.__init__(self, ax, on_move=on_move,
on_enter=on_enter, on_release=on_release)
props = dict(edgecolor=None, facecolor='r', alpha=0.15)
props.update(rectprops if rectprops is not None else {})
props.update(rect_props if rect_props is not None else {})
if props['edgecolor'] is None:
props['edgecolor'] = props['facecolor']
mwidgets.RectangleSelector.__init__(self, ax, lambda *args: None,