Plot.Plot

class Plot(layout, size)

A Plot wraps a plot layout such that it can be saved to and loaded from an HDF5 file.

Parameters:
  • layout (BaseLayout based) – The plot layout to wrap.

  • size (2-tuple of floats) – The pixel size of the layout.

find(*, types=None, function=None, **kwargs)

Find plot items within this plot filtered on type and properties.

Find all lines with e.g. the label “Result”, by writing:

layout.find(types=Line, label='Result')

Or find all Scatter plots with an outline:

layout.find(types=Scatter, outline=True).

Or all lines which has a label that starts with the characters ‘band’,:

def labelStartWithBand(item):
    return item.label().lower().startswith('band')

layout.find(
    types=Line,
    function=labelStartsWithBand
).
Parameters:
  • types (None | PlotItem type) – An optional type or types, e.g. Line or Scatter.

  • function (None | function) – An optional filter function taking the plot item as the only input.

  • **kwargs (dict) – Optional properties which should be matched exactly for the items.

Returns:

A list of the items matching the query.

Return type:

list of PlotItem

layout()
Returns:

The wrapped plot layout.

Return type:

BaseLayout based

metatext()
Returns:

The metatext of the object or None if no metatext is present.

Return type:

str | None

setMetatext(metatext)

Set a given metatext string on the object.

Parameters:

metatext (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

size()
Returns:

The layout pixel size.

Return type:

2-tuple of floats

uniqueString()

Return a unique string representing the state of the object.