From 260984c018ab7532d948a395f5c8ba239d10e76a Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Thu, 13 Dec 2012 21:11:53 -0500 Subject: [PATCH] DOC: Add parameters to docstring --- skimage/viewer/canvastools/base.py | 12 ++++++++++ skimage/viewer/canvastools/linetool.py | 31 ++++++++++++++++++++++++-- skimage/viewer/canvastools/recttool.py | 3 ++- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/skimage/viewer/canvastools/base.py b/skimage/viewer/canvastools/base.py index 3d179578..05709c61 100644 --- a/skimage/viewer/canvastools/base.py +++ b/skimage/viewer/canvastools/base.py @@ -18,6 +18,18 @@ class CanvasToolBase(object): Parameters ---------- + ax : :class:`matplotlib.axes.Axes` + Matplotlib axes where tool is displayed. + on_move : function + Function called whenever a control handle is moved. + This function must accept the end points of line as the only argument. + on_release : function + Function called whenever the control handle is released. + on_enter : function + Function called whenever the "enter" key is pressed. + useblit : bool + If True, update canvas by blitting, which is much faster than normal + redrawing (turn off for debugging purposes). """ def __init__(self, ax, on_move=None, on_enter=None, on_release=None, useblit=True): diff --git a/skimage/viewer/canvastools/linetool.py b/skimage/viewer/canvastools/linetool.py index ea639ee1..6937f38a 100644 --- a/skimage/viewer/canvastools/linetool.py +++ b/skimage/viewer/canvastools/linetool.py @@ -16,6 +16,8 @@ class LineTool(CanvasToolBase): Parameters ---------- + ax : :class:`matplotlib.axes.Axes` + Matplotlib axes where tool is displayed. on_move : function Function called whenever a control handle is moved. This function must accept the end points of line as the only argument. @@ -26,8 +28,7 @@ class LineTool(CanvasToolBase): 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`. + Properties for :class:`matplotlib.lines.Line2D`. Attributes ---------- @@ -117,6 +118,32 @@ class LineTool(CanvasToolBase): class ThickLineTool(LineTool): + """Widget for line selection in a plot. + + The thickness of the line can be varied using the mouse scroll wheel, or + with the '+' and '-' keys. + + Parameters + ---------- + ax : :class:`matplotlib.axes.Axes` + Matplotlib axes where tool is displayed. + on_move : function + Function called whenever a control handle is moved. + This function must accept the end points of line as the only argument. + on_release : function + 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.lines.Line2D`. + + Attributes + ---------- + end_points : 2D array + End points of line ((x1, y1), (x2, y2)). + """ def __init__(self, ax, on_move=None, on_enter=None, on_release=None, maxdist=10, line_props=None): diff --git a/skimage/viewer/canvastools/recttool.py b/skimage/viewer/canvastools/recttool.py index a8b74e87..ce321c42 100644 --- a/skimage/viewer/canvastools/recttool.py +++ b/skimage/viewer/canvastools/recttool.py @@ -18,7 +18,8 @@ class RectangleTool(mwidgets.RectangleSelector, CanvasToolBase): Parameters ---------- - ax : :class:`matplotlib.axes.Axes + ax : :class:`matplotlib.axes.Axes` + Matplotlib axes where tool is displayed. on_move : function Function called whenever a control handle is moved. This function must accept the rectangle extents as the only argument.