From 912f1f13c26186d27c9b7aa94a7cb03b5a3deccb Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Fri, 28 Feb 2014 20:27:22 -0500 Subject: [PATCH] documentation fixes --- doc/source/graphicsItems/index.rst | 2 +- doc/source/graphicsItems/roi.rst | 22 ++++- pyqtgraph/graphicsItems/AxisItem.py | 2 +- pyqtgraph/graphicsItems/PlotDataItem.py | 38 +++++---- pyqtgraph/graphicsItems/ROI.py | 107 +++++++++++++----------- 5 files changed, 100 insertions(+), 71 deletions(-) diff --git a/doc/source/graphicsItems/index.rst b/doc/source/graphicsItems/index.rst index b15c205c..970e9500 100644 --- a/doc/source/graphicsItems/index.rst +++ b/doc/source/graphicsItems/index.rst @@ -1,4 +1,4 @@ -Pyqtgraph's Graphics Items +PyQtGraph's Graphics Items ========================== Since pyqtgraph relies on Qt's GraphicsView framework, most of its graphics functionality is implemented as QGraphicsItem subclasses. This has two important consequences: 1) virtually anything you want to draw can be easily accomplished using the functionality provided by Qt. 2) Many of pyqtgraph's GraphicsItem classes can be used in any normal QGraphicsScene. diff --git a/doc/source/graphicsItems/roi.rst b/doc/source/graphicsItems/roi.rst index 22945ade..f4f4346d 100644 --- a/doc/source/graphicsItems/roi.rst +++ b/doc/source/graphicsItems/roi.rst @@ -4,5 +4,25 @@ ROI .. autoclass:: pyqtgraph.ROI :members: - .. automethod:: pyqtgraph.ROI.__init__ +.. autoclass:: pyqtgraph.RectROI + :members: + +.. autoclass:: pyqtgraph.EllipseROI + :members: + +.. autoclass:: pyqtgraph.CircleROI + :members: + +.. autoclass:: pyqtgraph.LineSegmentROI + :members: + +.. autoclass:: pyqtgraph.PolyLineROI + :members: + +.. autoclass:: pyqtgraph.LineROI + :members: + +.. autoclass:: pyqtgraph.MultiRectROI + :members: + diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index 66efeda5..69ad695c 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -164,7 +164,7 @@ class AxisItem(GraphicsWidget): without any scaling prefix (eg, 'V' instead of 'mV'). The scaling prefix will be automatically prepended based on the range of data displayed. - **args All extra keyword arguments become CSS style options for + \**args All extra keyword arguments become CSS style options for the tag which will surround the axis label and units. ============= ============================================================= diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py index 8baab719..29d48db6 100644 --- a/pyqtgraph/graphicsItems/PlotDataItem.py +++ b/pyqtgraph/graphicsItems/PlotDataItem.py @@ -56,7 +56,7 @@ class PlotDataItem(GraphicsObject): =========================== ========================================= **Line style keyword arguments:** - ========== ================================================ + ========== ============================================================================== connect Specifies how / whether vertexes should be connected. See :func:`arrayToQPath() ` pen Pen to use for drawing line between points. @@ -67,21 +67,25 @@ class PlotDataItem(GraphicsObject): fillLevel Fill the area between the curve and fillLevel fillBrush Fill to use when fillLevel is specified. May be any single argument accepted by :func:`mkBrush() ` - ========== ================================================ + ========== ============================================================================== **Point style keyword arguments:** (see :func:`ScatterPlotItem.setData() ` for more information) - ============ ================================================ - symbol Symbol to use for drawing points OR list of symbols, one per point. Default is no symbol. + ============ ===================================================== + symbol Symbol to use for drawing points OR list of symbols, + one per point. Default is no symbol. Options are o, s, t, d, +, or any QPainterPath - symbolPen Outline pen for drawing points OR list of pens, one per point. - May be any single argument accepted by :func:`mkPen() ` - symbolBrush Brush for filling points OR list of brushes, one per point. - May be any single argument accepted by :func:`mkBrush() ` + symbolPen Outline pen for drawing points OR list of pens, one + per point. May be any single argument accepted by + :func:`mkPen() ` + symbolBrush Brush for filling points OR list of brushes, one per + point. May be any single argument accepted by + :func:`mkBrush() ` symbolSize Diameter of symbols OR list of diameters. - pxMode (bool) If True, then symbolSize is specified in pixels. If False, then symbolSize is + pxMode (bool) If True, then symbolSize is specified in + pixels. If False, then symbolSize is specified in data coordinates. - ============ ================================================ + ============ ===================================================== **Optimization keyword arguments:** @@ -92,11 +96,11 @@ class PlotDataItem(GraphicsObject): decimate deprecated. downsample (int) Reduce the number of samples displayed by this value downsampleMethod 'subsample': Downsample by taking the first of N samples. - This method is fastest and least accurate. + This method is fastest and least accurate. 'mean': Downsample by taking the mean of N samples. 'peak': Downsample by drawing a saw wave that follows the min - and max of the original data. This method produces the best - visual representation of the data but is slower. + and max of the original data. This method produces the best + visual representation of the data but is slower. autoDownsample (bool) If True, resample the data before plotting to avoid plotting multiple line segments per pixel. This can improve performance when viewing very high-density data, but increases the initial overhead @@ -294,13 +298,13 @@ class PlotDataItem(GraphicsObject): Arguments ds (int) Reduce visible plot samples by this factor. To disable, set ds=1. - auto (bool) If True, automatically pick *ds* based on visible range + auto (bool) If True, automatically pick *ds* based on visible range. mode 'subsample': Downsample by taking the first of N samples. - This method is fastest and least accurate. + This method is fastest and least accurate. 'mean': Downsample by taking the mean of N samples. 'peak': Downsample by drawing a saw wave that follows the min - and max of the original data. This method produces the best - visual representation of the data but is slower. + and max of the original data. This method produces the best + visual representation of the data but is slower. =========== ================================================================= """ changed = False diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py index ef2f329b..bea0d730 100644 --- a/pyqtgraph/graphicsItems/ROI.py +++ b/pyqtgraph/graphicsItems/ROI.py @@ -46,8 +46,8 @@ class ROI(GraphicsObject): that allow the user to manibulate the ROI. - Signals - ----------------------- ---------------------------------------------------- + ======================= ==================================================== + **Signals** sigRegionChangeFinished Emitted when the user stops dragging the ROI (or one of its handles) or if the ROI is changed programatically. @@ -65,11 +65,11 @@ class ROI(GraphicsObject): details. sigRemoveRequested Emitted when the user selects 'remove' from the ROI's context menu (if available). - ----------------------- ---------------------------------------------------- + ======================= ==================================================== - Arguments - ---------------- ----------------------------------------------------------- + ================ =========================================================== + **Arguments** pos (length-2 sequence) Indicates the position of the ROI's origin. For most ROIs, this is the lower-left corner of its bounding rectangle. @@ -101,7 +101,7 @@ class ROI(GraphicsObject): an option to remove the ROI. The ROI emits sigRemoveRequested when this menu action is selected. Default is False. - ---------------- ----------------------------------------------------------- + ================ =========================================================== """ sigRegionChangeFinished = QtCore.Signal(object) @@ -276,11 +276,14 @@ class ROI(GraphicsObject): If the ROI is bounded and the move would exceed boundaries, then the ROI is moved to the nearest acceptable position instead. - snap can be: - None (default): use self.translateSnap and self.snapSize to determine whether/how to snap - False: do not snap - Point(w,h) snap to rectangular grid with spacing (w,h) - True: snap using self.snapSize (and ignoring self.translateSnap) + *snap* can be: + + =============== ========================================================================== + None (default) use self.translateSnap and self.snapSize to determine whether/how to snap + False do not snap + Point(w,h) snap to rectangular grid with spacing (w,h) + True snap using self.snapSize (and ignoring self.translateSnap) + =============== ========================================================================== Also accepts *update* and *finish* arguments (see setPos() for a description of these). """ @@ -346,8 +349,8 @@ class ROI(GraphicsObject): ROI. However, for larger ROIs it may be desirable to disable this and instead provide one or more translation handles. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -357,7 +360,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ pos = Point(pos) return self.addHandle({'name': name, 'type': 't', 'pos': pos, 'item': item}, index=index) @@ -367,8 +370,8 @@ class ROI(GraphicsObject): Add a new free handle to the ROI. Dragging free handles has no effect on the position or shape of the ROI. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -378,7 +381,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ if pos is not None: pos = Point(pos) @@ -389,8 +392,8 @@ class ROI(GraphicsObject): Add a new scale handle to the ROI. Dragging a scale handle allows the user to change the height and/or width of the ROI. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -404,7 +407,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ pos = Point(pos) center = Point(center) @@ -420,8 +423,8 @@ class ROI(GraphicsObject): Add a new rotation handle to the ROI. Dragging a rotation handle allows the user to change the angle of the ROI. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -433,7 +436,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ pos = Point(pos) center = Point(center) @@ -446,8 +449,8 @@ class ROI(GraphicsObject): arbitrary center point as well as scale the ROI by dragging the handle toward or away from the center point. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -459,7 +462,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ pos = Point(pos) center = Point(center) @@ -474,8 +477,8 @@ class ROI(GraphicsObject): arbitrary center point, while moving toward or away from the center point has no effect on the shape of the ROI. - Arguments: - ------------------- ---------------------------------------------------- + =================== ==================================================== + **Arguments** pos (length-2 sequence) The position of the handle relative to the shape of the ROI. A value of (0,0) indicates the origin, whereas (1, 1) indicates the @@ -487,7 +490,7 @@ class ROI(GraphicsObject): name The name of this handle (optional). Handles are identified by name when calling getLocalHandlePositions and getSceneHandlePositions. - ------------------- ---------------------------------------------------- + =================== ==================================================== """ pos = Point(pos) center = Point(center) @@ -1030,8 +1033,8 @@ class ROI(GraphicsObject): """Use the position and orientation of this ROI relative to an imageItem to pull a slice from an array. + =================== ==================================================== **Arguments** - ------------------- ---------------------------------------------------- data The array to slice from. Note that this array does *not* have to be the same data that is represented in *img*. @@ -1043,9 +1046,9 @@ class ROI(GraphicsObject): returnMappedCoords (bool) If True, the array slice is returned along with a corresponding array of coordinates that were used to extract data from the original array. - **kwds All keyword arguments are passed to + \**kwds All keyword arguments are passed to :func:`affineSlice `. - ------------------- ---------------------------------------------------- + =================== ==================================================== This method uses :func:`affineSlice ` to generate the slice from *data* and uses :func:`getAffineSliceParams ` to determine the parameters to @@ -1548,8 +1551,8 @@ class RectROI(ROI): """ Rectangular ROI subclass with a single scale handle at the top-right corner. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- pos (length-2 sequence) The position of the ROI origin. See ROI(). size (length-2 sequence) The size of the ROI. See ROI(). @@ -1557,8 +1560,8 @@ class RectROI(ROI): center, rather than its origin. sideScalers (bool) If True, extra scale handles are added at the top and right edges. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, pos, size, centered=False, sideScalers=False, **args): @@ -1581,15 +1584,15 @@ class LineROI(ROI): allows the ROI to be positioned as if moving the ends of a line segment. A third handle controls the width of the ROI orthogonal to its "line" axis. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- pos1 (length-2 sequence) The position of the center of the ROI's left edge. pos2 (length-2 sequence) The position of the center of the ROI's right edge. width (float) The width of the ROI. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, pos1, pos2, width, **args): @@ -1617,12 +1620,12 @@ class MultiRectROI(QtGui.QGraphicsObject): an image similarly to PolyLineROI. It differs in that each segment of the chain is rectangular instead of linear and thus has width. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- points (list of length-2 sequences) The list of points in the path. width (float) The width of the ROIs orthogonal to the path. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ sigRegionChangeFinished = QtCore.Signal(object) sigRegionChangeStarted = QtCore.Signal(object) @@ -1751,12 +1754,12 @@ class EllipseROI(ROI): Elliptical ROI subclass with one scale handle and one rotation handle. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- pos (length-2 sequence) The position of the ROI's origin. size (length-2 sequence) The size of the ROI's bounding rectangle. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, pos, size, **args): @@ -1801,12 +1804,12 @@ class CircleROI(EllipseROI): Circular ROI subclass. Behaves exactly as EllipseROI, but may only be scaled proportionally to maintain its aspect ratio. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- pos (length-2 sequence) The position of the ROI's origin. size (length-2 sequence) The size of the ROI's bounding rectangle. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, pos, size, **args): @@ -1874,8 +1877,8 @@ class PolyLineROI(ROI): This class allows the user to draw paths of multiple line segments. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- positions (list of length-2 sequences) The list of points in the path. Note that, unlike the handle positions specified in other ROIs, these positions must be expressed in the normal @@ -1883,8 +1886,8 @@ class PolyLineROI(ROI): to the size of the ROI. closed (bool) if True, an extra LineSegmentROI is added connecting the beginning and end points. - **args All extra keyword arguments are passed to ROI() - -------------- ------------------------------------------------------------- + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, positions, closed=False, pos=None, **args): @@ -2032,13 +2035,15 @@ class LineSegmentROI(ROI): """ ROI subclass with two freely-moving handles defining a line. + ============== ============================================================= **Arguments** - -------------- ------------------------------------------------------------- positions (list of two length-2 sequences) The endpoints of the line segment. Note that, unlike the handle positions specified in other ROIs, these positions must be expressed in the normal coordinate system of the ROI, rather than (0 to 1) relative to the size of the ROI. + \**args All extra keyword arguments are passed to ROI() + ============== ============================================================= """ def __init__(self, positions=(None, None), pos=None, handles=(None,None), **args):