# Plotting series item

## QwtPlotSeriesItem

class qwt.plot_series.QwtPlotSeriesItem(title)

  Base class for plot items representing a series of samples

  setOrientation(orientation)

    Set the orientation of the item. Default is Qt.Horizontal.

    The orientation() might be used in specific way by a plot item. F.e. a QwtPlotCurve uses it to identify how to display the curve int QwtPlotCurve.Steps or QwtPlotCurve.Sticks style.

    See also

    :py:meth`orientation()`

  orientation()
    Returns

      Orientation of the plot item

    See also

    :py:meth`setOrientation()`

  draw(painter, xMap, yMap, canvasRect)

    Draw the complete series

    Parameters

      - painter (QPainter) – Painter

      - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.

      - yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.

      - canvasRect (QRectF) – Contents rectangle of the canvas

  drawSeries(painter, xMap, yMap, canvasRect, from_, to)

    Draw a subset of the samples

    Parameters

      - painter (QPainter) – Painter

      - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.

      - yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.

      - canvasRect (QRectF) – Contents rectangle of the canvas

      - from (int) – Index of the first point to be painted

      - to (int) – Index of the last point to be painted. If to < 0 the curve will be painted to its last point.

    See also

    This method is implemented in qwt.plot_curve.QwtPlotCurve

  boundingRect()
    Returns

      An invalid bounding rect: QRectF(1.0, 1.0, -2.0, -2.0)

    Note

    A width or height < 0.0 is ignored by the autoscaler

## QwtSeriesData

class qwt.plot_series.QwtSeriesData

  Abstract interface for iterating over samples

  PythonQwt offers several implementations of the QwtSeriesData API, but in situations, where data of an application specific format needs to be displayed, without having to copy it, it is recommended to implement an individual data access.

  A subclass of QwtSeriesData must implement:

  > > - size():

  > >   Should return number of data points.

  > - sample()

  >   > Should return values x and y values of the sample at specific position as QPointF object.

  > - boundingRect()

  >   > Should return the bounding rectangle of the data series. It is used for autoscaling and might help certain algorithms for displaying the data. The member _boundingRect is intended for caching the calculated rectangle.

  setRectOfInterest(rect)

    Set a the “rect of interest”

    QwtPlotSeriesItem defines the current area of the plot canvas as “rectangle of interest” ( QwtPlotSeriesItem::updateScaleDiv() ). It can be used to implement different levels of details.

    The default implementation does nothing.

    Parameters

      rect (QRectF) – Rectangle of interest

  size()
    Returns

      Number of samples

  sample(i)

    Return a sample

    Parameters

      i (int) – Index

    Returns

      Sample at position i

  boundingRect()

    Calculate the bounding rect of all samples

    The bounding rect is necessary for autoscaling and can be used for a couple of painting optimizations.

    Returns

      Bounding rectangle

## QwtPointArrayData

class qwt.plot_series.QwtPointArrayData(x=None, y=None, size=None, finite=None)

  Interface for iterating over two array objects

  class QwtCQwtPointArrayDataolorMap(x, y[, size=None])
    Parameters

      - x (list or tuple or numpy.array) – Array of x values

      - y (list or tuple or numpy.array) – Array of y values

      - size (int) – Size of the x and y arrays

      - finite (bool) – if True, keep only finite array elements (remove all infinity and not a number values), otherwise do not filter array elements

  boundingRect()

    Calculate the bounding rectangle

    The bounding rectangle is calculated once by iterating over all points and is stored for all following requests.

    Returns

      Bounding rectangle

  size()
    Returns

      Size of the data set

  sample(index)
    Parameters

      index (int) – Index

    Returns

      Sample at position index

  xData()
    Returns

      Array of the x-values

  yData()
    Returns

      Array of the y-values

## QwtSeriesStore

class qwt.plot_series.QwtSeriesStore

  Class storing a QwtSeriesData object

  QwtSeriesStore and QwtPlotSeriesItem are intended as base classes for all plot items iterating over a series of samples.

  setData(series)

    Assign a series of samples

    Parameters

      series (qwt.plot_series.QwtSeriesData) – Data

    Warning

    The item takes ownership of the data object, deleting it when its not used anymore.

  data()
    Returns

      the series data

  sample(index)
    Parameters

      index (int) – Index

    Returns

      Sample at position index

  dataSize()
    Returns

      Number of samples of the series

    See also

    `setData()`, `qwt.plot_series.QwtSeriesData.size()`

  dataRect()
    Returns

      Bounding rectangle of the series or an invalid rectangle, when no series is stored

    See also

    `qwt.plot_series.QwtSeriesData.boundingRect()`

  setRectOfInterest(rect)

    Set a the “rect of interest” for the series

    Parameters

      rect (QRectF) – Rectangle of interest

    See also

    `qwt.plot_series.QwtSeriesData.setRectOfInterest()`

  swapData(series)

    Replace a series without deleting the previous one

    Parameters

      series (qwt.plot_series.QwtSeriesData) – New series

    Returns

      Previously assigned series