Merge pull request #1326 from ixjlyons/doc-multiplotitem

Improve docs for MultiPlotWidget and MultiPlotItem
This commit is contained in:
Kenneth Lyons 2020-08-01 17:19:18 -07:00 committed by GitHub
commit 7504f2ba27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 5 deletions

View File

@ -18,6 +18,7 @@ Contents:
infiniteline infiniteline
roi roi
graphicslayout graphicslayout
multiplotitem
plotcurveitem plotcurveitem
scatterplotitem scatterplotitem
isocurveitem isocurveitem

View File

@ -0,0 +1,5 @@
MultiPlotItem
=============
.. autoclass:: pyqtgraph.MultiPlotItem
:members:

View File

@ -4,22 +4,33 @@ MultiPlotItem.py - Graphics item used for displaying an array of PlotItems
Copyright 2010 Luke Campagnola Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more information. Distributed under MIT/X11 license. See license.txt for more information.
""" """
from numpy import ndarray
from . import GraphicsLayout from . import GraphicsLayout
from ..metaarray import * from ..metaarray import *
__all__ = ['MultiPlotItem'] __all__ = ['MultiPlotItem']
class MultiPlotItem(GraphicsLayout.GraphicsLayout): class MultiPlotItem(GraphicsLayout.GraphicsLayout):
""" """
Automatically generates a grid of plots from a multi-dimensional array :class:`~pyqtgraph.GraphicsLayout` that automatically generates a grid of
plots from a MetaArray.
.. seealso:: :class:`~pyqtgraph.MultiPlotWidget`: Widget containing a MultiPlotItem
""" """
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
GraphicsLayout.GraphicsLayout.__init__(self, *args, **kwds) GraphicsLayout.GraphicsLayout.__init__(self, *args, **kwds)
self.plots = [] self.plots = []
def plot(self, data, **plotArgs): def plot(self, data, **plotArgs):
"""Plot the data from a MetaArray with each array column as a separate
:class:`~pyqtgraph.PlotItem`.
Axis labels are automatically extracted from the array info.
``plotArgs`` are passed to :meth:`PlotItem.plot
<pyqtgraph.PlotItem.plot>`.
"""
#self.layout.clear() #self.layout.clear()
if hasattr(data, 'implements') and data.implements('MetaArray'): if hasattr(data, 'implements') and data.implements('MetaArray'):

View File

@ -10,7 +10,8 @@ from ..graphicsItems import MultiPlotItem as MultiPlotItem
__all__ = ['MultiPlotWidget'] __all__ = ['MultiPlotWidget']
class MultiPlotWidget(GraphicsView): class MultiPlotWidget(GraphicsView):
"""Widget implementing a graphicsView with a single MultiPlotItem inside.""" """Widget implementing a :class:`~pyqtgraph.GraphicsView` with a single
:class:`~pyqtgraph.MultiPlotItem` inside."""
def __init__(self, parent=None): def __init__(self, parent=None):
self.minPlotHeight = 50 self.minPlotHeight = 50
self.mPlotItem = MultiPlotItem.MultiPlotItem() self.mPlotItem = MultiPlotItem.MultiPlotItem()