Item builder¶
The builder module provides a builder singleton class that can be used to simplify the creation of plot items.
- plotpy.builder.make = <plotpy.builder.PlotBuilder object>¶
Instance of
PlotBuilder
- class plotpy.constants.LUTAlpha(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
LUT Alpha functions
- NONE = 0¶
No alpha function
- CONSTANT = 1¶
Constant alpha function
- LINEAR = 2¶
Linear alpha function
- SIGMOID = 3¶
Sigmoid alpha function
- TANH = 4¶
Hyperbolic tangent alpha function
- STEP = 5¶
Transparent lowest value and opaque highest value
- class plotpy.builder.PlotBuilder[source]¶
Class regrouping a set of factory functions to simplify the creation of plot widgets and plot items.
It is a singleton class, so you should not create instances of this class but use the
plotpy.builder.make
instance instead.- widget(parent: QWidget | None = None, toolbar: bool = False, panels: tuple[PanelWidget] | None = None, auto_tools: bool = True, title: str | None = None, xlabel: str | tuple[str, str] | None = None, ylabel: str | tuple[str, str] | None = None, zlabel: str | None = None, xunit: str | tuple[str, str] | None = None, yunit: str | tuple[str, str] | None = None, zunit: str | None = None, yreverse: bool | None = None, aspect_ratio: float = 1.0, lock_aspect_ratio: bool | None = None, curve_antialiasing: bool | None = None, gridparam: GridParam | None = None, section: str = 'plot', type: str | PlotType = 'auto', axes_synchronised: bool = False, force_colorbar_enabled: bool = False, no_image_analysis_widgets: bool = False, show_contrast: bool = False, show_itemlist: bool = False, show_xsection: bool = False, show_ysection: bool = False, xsection_pos: str = 'top', ysection_pos: str = 'right') PlotWidget ¶
Make a plot widget (
PlotWidget
object)- Parameters:
parent – Parent widget
toolbar – Show/hide toolbar
panels – Additionnal panels
auto_tools – If True, the plot tools are automatically registered. If False, the user must register the tools manually.
title – The plot title
xlabel – (bottom axis title, top axis title) or bottom axis title only
ylabel – (left axis title, right axis title) or left axis title only
zlabel – The Z-axis label
xunit – (bottom axis unit, top axis unit) or bottom axis unit only
yunit – (left axis unit, right axis unit) or left axis unit only
zunit – The Z-axis unit
yreverse – If True, the Y-axis is reversed
aspect_ratio – The plot aspect ratio
lock_aspect_ratio – If True, the aspect ratio is locked
curve_antialiasing – If True, the curve antialiasing is enabled
gridparam – The grid parameters
section – The plot configuration section name (“plot”, by default)
type – The plot type (“auto”, “manual”, “curve” or “image”)
axes_synchronised – If True, the axes are synchronised
force_colorbar_enabled – If True, the colorbar is always enabled
no_image_analysis_widgets – If True, the image analysis widgets are not added
show_contrast – If True, the contrast adjustment panel is visible
show_itemlist – If True, the itemlist panel is visible
show_xsection – If True, the X-axis cross section panel is visible
show_ysection – If True, the Y-axis cross section panel is visible
xsection_pos – The X-axis cross section panel position (“top” or “bottom”)
ysection_pos – The Y-axis cross section panel position (“left” or “right”)
- dialog(parent: QWidget | None = None, toolbar: bool = False, panels: tuple[PanelWidget] | None = None, auto_tools: bool = True, wintitle: str = 'PlotPy', icon: str = 'plotpy.svg', edit: bool = False, size: tuple[int, int] | None = None, title: str | None = None, xlabel: str | tuple[str, str] | None = None, ylabel: str | tuple[str, str] | None = None, zlabel: str | None = None, xunit: str | tuple[str, str] | None = None, yunit: str | tuple[str, str] | None = None, zunit: str | None = None, yreverse: bool | None = None, aspect_ratio: float = 1.0, lock_aspect_ratio: bool | None = None, curve_antialiasing: bool | None = None, gridparam: GridParam | None = None, section: str = 'plot', type: str | PlotType = 'auto', axes_synchronised: bool = False, force_colorbar_enabled: bool = False, no_image_analysis_widgets: bool = False, show_contrast: bool = False, show_itemlist: bool = False, show_xsection: bool = False, show_ysection: bool = False, xsection_pos: str = 'top', ysection_pos: str = 'right') PlotDialog ¶
Make a plot dialog (
PlotDialog
object)- Parameters:
parent – Parent widget
toolbar – Show/hide toolbar
panels – Additionnal panels
auto_tools – If True, the plot tools are automatically registered. If False, the user must register the tools manually.
wintitle – The window title
icon – The window icon
edit – If True, the plot is editable
size – The window size
title – The plot title
xlabel – (bottom axis title, top axis title) or bottom axis title only
ylabel – (left axis title, right axis title) or left axis title only
zlabel – The Z-axis label
xunit – (bottom axis unit, top axis unit) or bottom axis unit only
yunit – (left axis unit, right axis unit) or left axis unit only
zunit – The Z-axis unit
yreverse – If True, the Y-axis is reversed
aspect_ratio – The plot aspect ratio
lock_aspect_ratio – If True, the aspect ratio is locked
curve_antialiasing – If True, the curve antialiasing is enabled
gridparam – The grid parameters
section – The plot configuration section name (“plot”, by default)
type – The plot type (“auto”, “manual”, “curve” or “image”)
axes_synchronised – If True, the axes are synchronised
force_colorbar_enabled – If True, the colorbar is always enabled
no_image_analysis_widgets – If True, the image analysis widgets are not added
show_contrast – If True, the contrast adjustment panel is visible
show_itemlist – If True, the itemlist panel is visible
show_xsection – If True, the X-axis cross section panel is visible
show_ysection – If True, the Y-axis cross section panel is visible
xsection_pos – The X-axis cross section panel position (“top” or “bottom”)
ysection_pos – The Y-axis cross section panel position (“left” or “right”)
- window(parent: QWidget | None = None, toolbar: bool = False, panels: tuple[PanelWidget] | None = None, auto_tools: bool = True, wintitle: str = 'PlotPy', icon: str = 'plotpy.svg', size: tuple[int, int] | None = None, title: str | None = None, xlabel: str | tuple[str, str] | None = None, ylabel: str | tuple[str, str] | None = None, zlabel: str | None = None, xunit: str | tuple[str, str] | None = None, yunit: str | tuple[str, str] | None = None, zunit: str | None = None, yreverse: bool | None = None, aspect_ratio: float = 1.0, lock_aspect_ratio: bool | None = None, curve_antialiasing: bool | None = None, gridparam: GridParam | None = None, section: str = 'plot', type: str | PlotType = 'auto', axes_synchronised: bool = False, force_colorbar_enabled: bool = False, no_image_analysis_widgets: bool = False, show_contrast: bool = False, show_itemlist: bool = False, show_xsection: bool = False, show_ysection: bool = False, xsection_pos: str = 'top', ysection_pos: str = 'right') PlotWindow ¶
Make a plot window (
PlotWindow
object)- Parameters:
parent – Parent widget
toolbar – Show/hide toolbar
panels – Additionnal panels
auto_tools – If True, the plot tools are automatically registered. If False, the user must register the tools manually.
wintitle – The window title
icon – The window icon
size – The window size
title – The plot title
xlabel – (bottom axis title, top axis title) or bottom axis title only
ylabel – (left axis title, right axis title) or left axis title only
zlabel – The Z-axis label
xunit – (bottom axis unit, top axis unit) or bottom axis unit only
yunit – (left axis unit, right axis unit) or left axis unit only
zunit – The Z-axis unit
yreverse – If True, the Y-axis is reversed
aspect_ratio – The plot aspect ratio
lock_aspect_ratio – If True, the aspect ratio is locked
curve_antialiasing – If True, the curve antialiasing is enabled
gridparam – The grid parameters
section – The plot configuration section name (“plot”, by default)
type – The plot type (“auto”, “manual”, “curve” or “image”)
axes_synchronised – If True, the axes are synchronised
force_colorbar_enabled – If True, the colorbar is always enabled
no_image_analysis_widgets – If True, the image analysis widgets are not added
show_contrast – If True, the contrast adjustment panel is visible
show_itemlist – If True, the itemlist panel is visible
show_xsection – If True, the X-axis cross section panel is visible
show_ysection – If True, the Y-axis cross section panel is visible
xsection_pos – The X-axis cross section panel position (“top” or “bottom”)
ysection_pos – The Y-axis cross section panel position (“left” or “right”)
- gridparam(background: str | None = None, major_enabled: tuple[bool, bool] | None = None, minor_enabled: tuple[bool, bool] | None = None, major_style: tuple[str, str, int] | None = None, minor_style: tuple[str, str, int] | None = None) GridParam ¶
Make
GridParam
instance- Parameters:
background – canvas background color
major_enabled – major grid enabled (x, y)
minor_enabled – minor grid enabled (x, y)
major_style – major grid style (linestyle, color, width)
minor_style – minor grid style (linestyle, color, width)
- Returns:
grid parameters
- Return type:
- grid(background: str | None = None, major_enabled: tuple[bool, bool] | None = None, minor_enabled: tuple[bool, bool] | None = None, major_style: tuple[str, str, int] | None = None, minor_style: tuple[str, str, int] | None = None) GridItem ¶
Make a grid plot item (
GridItem
object)- Parameters:
background – canvas background color
major_enabled – major grid enabled (x, y)
minor_enabled – minor grid enabled (x, y)
major_style – major grid style (linestyle, color, width)
minor_style – minor grid style (linestyle, color, width)
- Returns:
grid item
- Return type:
- mcurve(*args, **kwargs) CurveItem | list[CurveItem] ¶
Make a curve plot item based on MATLAB-like syntax (may returns a list of curves if data contains more than one signal)
- Parameters:
args – x, y, style
kwargs – title, color, linestyle, linewidth, marker, markersize,
markerfacecolor
markeredgecolor
shade
curvestyle
baseline
:param : :param dsamp_factor: :param use_dsamp:
- Returns:
CurveItem
object
- Example::
mcurve(x, y, ‘r+’)
- pcurve(x: ndarray, y: ndarray, param: CurveParam, xaxis: str = 'bottom', yaxis: str = 'left') CurveItem ¶
Make a curve plot item based on a
CurveParam
instance- Parameters:
x – x data
y – y data
param – curve parameters
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
- Returns:
CurveItem
object
- Example::
pcurve(x, y, param)
- curve(x: ndarray, y: ndarray, title: str = '', color: str | None = None, linestyle: str | None = None, linewidth: int | None = None, marker: str | None = None, markersize: int | None = None, markerfacecolor: str | None = None, markeredgecolor: str | None = None, shade: bool | None = None, curvestyle: str | None = None, baseline: float | None = None, xaxis: str = 'bottom', yaxis: str = 'left', dsamp_factor: int | None = None, use_dsamp: bool | None = None, dx: ndarray | None = None, dy: ndarray | None = None, errorbarwidth: int | None = None, errorbarcap: int | None = None, errorbarmode: str | None = None, errorbaralpha: float | None = None) CurveItem ¶
Make a curve plot item from x, y, data
- Parameters:
x – x data
y – y data
title – curve title. Default is ‘’
color – curve color name. Default is None
linestyle – curve line style (MATLAB-like string or “SolidLine”, “DashLine”, “DotLine”, “DashDotLine”, “DashDotDotLine”, “NoPen”). Default is None
linewidth – line width (pixels). Default is None
marker – marker shape (MATLAB-like string or “Cross”, “Ellipse”, “Star1”, “XCross”, “Rect”, “Diamond”, “UTriangle”, “DTriangle”, “RTriangle”, “LTriangle”, “Star2”, “NoSymbol”). Default is None
markersize – marker size (pixels). Default is None
markerfacecolor – marker face color name. Default is None
markeredgecolor – marker edge color name. Default is None
shade – 0 <= float <= 1 (curve shade). Default is None
curvestyle – “Lines”, “Sticks”, “Steps”, “Dots”, “NoCurve”. Default is None
baseline – baseline value. Default is None
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
dsamp_factor – downsampling factor. Default is None
use_dsamp – use downsampling. Default is None
dx – x error data. Default is None
dy – y error data. Default is None
errorbarwidth – error bar width (pixels). Default is None
errorbarcap – error bar cap size (pixels). Default is None
errorbarmode – error bar mode (“Vertical”, “Horizontal”, “Both”). Default is None
errorbaralpha – 0 <= float <= 1 (error bar transparency). Default is None
- Returns:
CurveItem
object
- Example::
curve(x, y, marker=’Ellipse’, markerfacecolor=’#ffffff’)
which is equivalent to (MATLAB-style support):
curve(x, y, marker='o', markerfacecolor='w')
- merror(*args, **kwargs) ErrorBarCurveItem ¶
Make an errorbar curve plot item based on MATLAB-like syntax
- Parameters:
args – x, y, dx, dy, style
kwargs – title, color, linestyle, linewidth, marker, markersize, markerfacecolor, markeredgecolor, shade, curvestyle, baseline, xaxis, yaxis, errorbarwidth, errorbarcap, errorbarmode, errorbaralpha
- Returns:
ErrorBarCurveItem
object
- Example::
mcurve(x, y, ‘r+’)
- perror(x: ndarray, y: ndarray, dx: ndarray, dy: ndarray, curveparam: CurveParam, errorbarparam: ErrorBarParam, xaxis: str = 'bottom', yaxis: str = 'left') ErrorBarCurveItem ¶
Make an errorbar curve plot item based on a
ErrorBarParam
instance- Parameters:
x – x data
y – y data
dx – x error data
dy – y error data
curveparam – curve style
errorbarparam – error bar style
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
- Returns:
ErrorBarCurveItem
object
- Example::
perror(x, y, dx, dy, curveparam, errorbarparam)
- error(x: ndarray, y: ndarray, dx: ndarray, dy: ndarray, title: str = '', color: str | None = None, linestyle: str | None = None, linewidth: float | None = None, errorbarwidth: int | None = None, errorbarcap: int | None = None, errorbarmode: str | None = None, errorbaralpha: float | None = None, marker: str | None = None, markersize: float | None = None, markerfacecolor: str | None = None, markeredgecolor: str | None = None, shade: bool | None = None, curvestyle: str | None = None, baseline: float | None = None, xaxis: str = 'bottom', yaxis: str = 'left', dsamp_factor: int | None = None, use_dsamp: bool | None = None) ErrorBarCurveItem ¶
Make an errorbar curve plot item
- Parameters:
x – x data
y – y data
dx – x error data
dy – y error data
title – curve title. Default is ‘’
color – curve color name. Default is None
linestyle – curve line style (MATLAB-like string or attribute name from the PyQt5.QtCore.Qt.PenStyle enum (i.e. “SolidLine” “DashLine”, “DotLine”, “DashDotLine”, “DashDotDotLine” or “NoPen”). Default is None
linewidth – line width (pixels). Default is None
errorbarwidth – error bar width (pixels). Default is None
errorbarcap – error bar cap length (pixels). Default is None
errorbarmode – error bar mode (MATLAB-like string or attribute name from the qwt.QwtPlotCurve.ErrorBar enum (i.e. “NoError”, “ErrorBar”, “ErrorSymbol”, “ErrorBarSymbol”, “ErrorBarCurve”). Default is None
errorbaralpha – error bar alpha value (0.0 transparent through 1.0 opaque). Default is None
marker – marker shape (MATLAB-like string or attribute name from the qwt.QwtSymbol.Style enum (i.e. “Cross”, “Ellipse”, “Star1”, “XCross”, “Rect”, “Diamond”, “UTriangle”, “DTriangle”, “RTriangle”, “LTriangle”, “NoSymbol”). Default is None
markersize – marker size (pixels). Default is None
markerfacecolor – marker face color name. Default is None
markeredgecolor – marker edge color name. Default is None
shade – shade under curve. Default is None
curvestyle – curve style (MATLAB-like string or attribute name from the qwt.QwtPlotCurve.CurveStyle enum (i.e. “NoCurve”, “Lines”, “Sticks”, “Steps”, “Dots”). Default is None
baseline – baseline value. Default is None
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
dsamp_factor – downsampling factor. Default is None
use_dsamp – use downsampling. Default is None
- Returns:
ErrorBarCurveItem
object
- Example::
error(x, y, None, dy, marker=’Ellipse’, markerfacecolor=’#ffffff’)
- which is equivalent to (MATLAB-style support)::
error(x, y, None, dy, marker=’o’, markerfacecolor=’w’)
- histogram(data: ndarray, bins: int | None = None, logscale: bool | None = None, title: str = '', color: str | None = None, xaxis: str = 'bottom', yaxis: str = 'left') HistogramItem ¶
Make 1D Histogram plot item
- Parameters:
data – data
bins – number of bins. Default is None
logscale – Y-axis scale. Default is None
title – curve title. Default is ‘’
color – curve color name. Default is None
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
- Returns:
HistogramItem
object
- phistogram(data: ndarray, curveparam: CurveParam, histparam: HistogramParam, xaxis: str = 'bottom', yaxis: str = 'left') HistogramItem ¶
Make 1D histogram plot item based on a
CurveParam
andHistogramParam
instances- Parameters:
data – data
curveparam – curve parameters
histparam – histogram parameters
xaxis – x axis name. Default is ‘bottom’
yaxis – y axis name. Default is ‘left’
- Returns:
HistogramItem
object
- Example::
phistogram(data, curveparam, histparam)
- range(xmin: float, xmax: float) XRangeSelection ¶
Make a range plot item
- Parameters:
xmin – minimum value
xmax – maximum value
- Returns:
XRangeSelection
object
- vcursor(x: float, label: str | None = None, constraint_cb: Callable | None = None, movable: bool = True, readonly: bool = False) Marker ¶
Make a vertical cursor plot item
- Parameters:
x – cursor position
label – cursor label. Default is None
constraint_cb – constraint callback. Default is None
movable – enable/disable cursor move. Default is True
readonly – enable/disable cursor edition. Default is False
- Returns:
Marker
object
- hcursor(y: float, label: str | None = None, constraint_cb: Callable | None = None, movable: bool = True, readonly: bool = False) Marker ¶
Make an horizontal cursor plot item
- Parameters:
y – cursor position
label – cursor label. Default is None
constraint_cb – constraint callback. Default is None
movable – enable/disable cursor move. Default is True
readonly – enable/disable cursor edition. Default is False
- Returns:
Marker
object
- xcursor(x: float, y: float, label: str | None = None, constraint_cb: Callable | None = None, movable: bool = True, readonly: bool = False) Marker ¶
Make a cross cursor plot item
- Parameters:
x – cursor position
y – cursor position
label – cursor label. Default is None
constraint_cb – constraint callback. Default is None
movable – enable/disable cursor move. Default is True
readonly – enable/disable cursor edition. Default is False
- Returns:
Marker
object
- marker(position: tuple[float, float] | None = None, label_cb: Callable | None = None, constraint_cb: Callable | None = None, movable: bool = True, readonly: bool = False, markerstyle: str | None = None, markerspacing: float | None = None, color: str | None = None, linestyle: str | None = None, linewidth: float | None = None, marker: str | None = None, markersize: float | None = None, markerfacecolor: str | None = None, markeredgecolor: str | None = None) Marker ¶
Make a marker plot item
- Parameters:
position – marker position
label_cb – label callback. Default is None
constraint_cb – constraint callback. Default is None
movable – enable/disable marker move. Default is True
readonly – enable/disable marker edition. Default is False
markerstyle – marker style. Default is None
markerspacing – spacing between text and marker line. Default is None
color – marker color name. Default is None
linestyle – marker line style (MATLAB-like string or attribute name from the PyQt5.QtCore.Qt.PenStyle enum (i.e. “SolidLine” “DashLine”, “DotLine”, “DashDotLine”, “DashDotDotLine” or “NoPen”). Default is None
linewidth – line width (pixels). Default is None
marker – marker shape (MATLAB-like string or “Cross”, “Plus”, “Circle”, “Disc”, “Square”, “Diamond”, “TriangleUp”, “TriangleDown”, “TriangleLeft”, “TriangleRight”, “TriRight”, “TriLeft”, “TriDown”, “TriUp”, “Octagon”, “Star1”, “Star2”, “Pentagon”, “Hexagon1”, “Hexagon2”, “Plus (filled)”, “Cross (filled)”, “Square (filled)”, “Diamond (filled)”, “TriangleUp (filled)”, “TriangleDown (filled)”, “TriangleLeft (filled)”, “TriangleRight (filled)”, “TriRight (filled)”, “TriLeft (filled)”, “TriDown (filled)”, “TriUp (filled)”, “Octagon (filled)”, “Star1 (filled)”, “Star2 (filled)”, “Pentagon (filled)”, “Hexagon1 (filled)”, “Hexagon2 (filled)”). Default is None
markersize – marker size (pixels). Default is None
markerfacecolor – marker face color name. Default is None
markeredgecolor – marker edge color name. Default is None
- Returns:
Marker
object
- image(data: ndarray | None = None, filename: str | None = None, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float | None = None, background_color: str | None = None, colormap: str | None = None, xdata: list[float] = [None, None], ydata: list[float] = [None, None], pixel_size: float | tuple[float, float] | None = None, center_on: tuple[float, float] | None = None, interpolation: str = 'linear', eliminate_outliers: float | None = None, xformat: str = '%.1f', yformat: str = '%.1f', zformat: str = '%.1f', x: ndarray | None = None, y: ndarray | None = None, lut_range: tuple[float, float] | None = None, lock_position: bool = True) ImageItem | XYImageItem | RGBImageItem ¶
Make an image plot item from data
- Parameters:
data – data. Default is None
filename – image filename. Default is None
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is None
background_color – background color name. Default is None
colormap – colormap name. Default is None
xdata – x data. Default is [None, None]
ydata – y data. Default is [None, None]
pixel_size – pixel size. Default is None
center_on – center on. Default is None
interpolation – interpolation method. Default is ‘linear’
eliminate_outliers – eliminate outliers. Default is None
xformat – x format. Default is ‘%.1f’
yformat – y format. Default is ‘%.1f’
zformat – z format. Default is ‘%.1f’
x – x data. Default is None
y – y data. Default is None
lut_range – LUT range. Default is None
lock_position – lock position. Default is True
- Returns:
ImageItem
object orXYImageItem
object if x and y are specified orRGBImageItem
object if data has 3 dimensions
- maskedimage(data: ndarray | None = None, mask: ndarray | None = None, filename: str | None = None, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float = 1.0, xdata: list[float] = [None, None], ydata: list[float] = [None, None], pixel_size: float | tuple[float, float] | None = None, center_on: tuple[float, float] | None = None, background_color: str | None = None, colormap: str | None = None, show_mask: bool = False, fill_value: float | None = None, interpolation: str = 'linear', eliminate_outliers: float | None = None, xformat: str = '%.1f', yformat: str = '%.1f', zformat: str = '%.1f', x: ndarray | None = None, y: ndarray | None = None, lut_range: tuple[float, float] | None = None, lock_position: bool = True) MaskedImageItem | MaskedXYImageItem ¶
Make a masked image plot item from data
- Parameters:
data – data. Default is None
mask – mask. Default is None
filename – image filename. Default is None
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is 1.0
xdata – x data. Default is [None, None]
ydata – y data. Default is [None, None]
pixel_size – pixel size. Default is None
center_on – center on. Default is None
background_color – background color. Default is None
colormap – colormap. Default is None
show_mask – show mask. Default is False
fill_value – fill value. Default is None
interpolation – interpolation method. Default is ‘linear’
eliminate_outliers – eliminate outliers. Default is None
xformat – x format. Default is ‘%.1f’
yformat – y format. Default is ‘%.1f’
zformat – z format. Default is ‘%.1f’
x – x data. Default is None
y – y data. Default is None
lut_range – LUT range. Default is None
lock_position – lock position. Default is True
- Returns:
MaskedImageItem
object orMaskedXYImageItem
object
- maskedxyimage(x: ndarray, y: ndarray, data: ndarray, mask: ndarray | None = None, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float = 1.0, background_color: str | None = None, colormap: str | None = None, show_mask: bool = False, fill_value: float | None = None, interpolation: str = 'linear', eliminate_outliers: float | None = None, xformat: str = '%.1f', yformat: str = '%.1f', zformat: str = '%.1f', lut_range: tuple[float, float] | None = None, lock_position: bool = True) MaskedXYImageItem ¶
Make a masked XY image plot item from data
- Parameters:
x – x data
y – y data
data – data
mask – mask. Default is None
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is 1.0
background_color – background color. Default is None
colormap – colormap. Default is None
show_mask – show mask. Default is False
fill_value – fill value. Default is None
interpolation – interpolation method. Default is ‘linear’
eliminate_outliers – eliminate outliers. Default is None
xformat – x format. Default is ‘%.1f’
yformat – y format. Default is ‘%.1f’
zformat – z format. Default is ‘%.1f’
lut_range – LUT range. Default is None
lock_position – lock position. Default is True
- Returns:
MaskedXYImageItem
object
- rgbimage(data: ndarray | None = None, filename: str | None = None, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float = 1.0, xdata: list | tuple = [None, None], ydata: list | tuple = [None, None], pixel_size: float | None = None, center_on: tuple | None = None, interpolation: str = 'linear', lock_position: bool = True) RGBImageItem ¶
Make a RGB image plot item from data
- Parameters:
data – data
filename – filename. Default is None
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is 1.0
xdata – x data. Default is [None, None]
ydata – y data. Default is [None, None]
pixel_size – pixel size. Default is None
center_on – center on. Default is None
interpolation – interpolation method. Default is ‘linear’
lock_position – lock position. Default is True
- Returns:
RGBImageItem
object
- quadgrid(X: ndarray, Y: ndarray, Z: ndarray, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float | None = None, colormap: str | None = None, interpolation: str = 'linear', lock_position: bool = True) QuadGridItem ¶
Make a pseudocolor plot item of a 2D array
- Parameters:
X – x data
Y – y data
Z – data
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is None
colormap – colormap. Default is None
interpolation – interpolation method. Default is ‘linear’
lock_position – lock position. Default is True
- Returns:
QuadGridItem
object
- pcolor(*args, **kwargs) QuadGridItem ¶
Make a pseudocolor plot item of a 2D array based on MATLAB-like syntax
- Parameters:
args – non-keyword arguments
kwargs – keyword arguments
- Returns:
QuadGridItem
object
- Examples::
pcolor(C) pcolor(X, Y, C)
- trimage(data: ndarray | None = None, filename: str | None = None, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float | None = None, background_color: str | None = None, colormap: str | None = None, x0: float = 0.0, y0: float = 0.0, angle: float = 0.0, dx: float = 1.0, dy: float = 1.0, interpolation: str = 'linear', eliminate_outliers: float | None = None, xformat: str = '%.1f', yformat: str = '%.1f', zformat: str = '%.1f', lut_range: tuple[float, float] | None = None, lock_position: bool = False) TrImageItem ¶
Make a transformable image plot item (image with an arbitrary affine transform)
- Parameters:
data – data
filename – filename. Default is None
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is None
background_color – background color. Default is None
colormap – colormap. Default is None
x0 – x position. Default is 0.0
y0 – y position. Default is 0.0
angle – angle (radians). Default is 0.0
dx – pixel size along X axis. Default is 1.0
dy – pixel size along Y axis. Default is 1.0
interpolation – interpolation method. Default is ‘linear’
eliminate_outliers – eliminate outliers. Default is None
xformat – x format. Default is ‘%.1f’
yformat – y format. Default is ‘%.1f’
zformat – z format. Default is ‘%.1f’
lut_range – LUT range. Default is None
lock_position – lock position. Default is False
- Returns:
TrImageItem
object
- xyimage(x: ndarray, y: ndarray, data: ndarray, title: str | None = None, alpha_function: LUTAlpha | str | None = None, alpha: float | None = None, background_color: str | None = None, colormap: str | None = None, interpolation: str = 'linear', eliminate_outliers: float | None = None, xformat: str = '%.1f', yformat: str = '%.1f', zformat: str = '%.1f', lut_range: tuple[float, float] | None = None, lock_position: bool = False) XYImageItem ¶
Make an xyimage plot item (image with non-linear X/Y axes) from data
- Parameters:
x – X coordinates
y – Y coordinates
data – data
title – image title. Default is None
alpha_function – function for LUT alpha channel. Default is
LUTAlpha.NONE
(valid string values are ‘none’, ‘constant’, ‘linear’, ‘sigmoid’, ‘tanh’ and ‘step’)alpha – alpha value. Default is None
background_color – background color. Default is None
colormap – colormap. Default is None
interpolation – interpolation method. Default is ‘linear’
eliminate_outliers – eliminate outliers. Default is None
xformat – x format. Default is ‘%.1f’
yformat – y format. Default is ‘%.1f’
zformat – z format. Default is ‘%.1f’
lut_range – LUT range. Default is None
lock_position – lock position. Default is True
- Returns:
XYImageItem
object
- imagefilter(xmin: float, xmax: float, ymin: float, ymax: float, imageitem: ImageItem, filter: Callable, title: str | None = None) ImageFilterItem ¶
Make a rectangular area image filter plot item
- Parameters:
xmin – xmin
xmax – xmax
ymin – ymin
ymax – ymax
imageitem – image item
filter – filter function
title – filter title. Default is None
- Returns:
ImageFilterItem
object
- contours(Z: ndarray, levels: float | ndarray, X: ndarray | None = None, Y: ndarray | None = None) list[ContourItem] ¶
Make a contour curves
- Parameters:
Z – The height values over which the contour is drawn.
levels – Determines the number and positions of the contour lines/regions. If a float, draw contour lines at this specified levels If array-like, draw contour lines at the specified levels. The values must be in increasing order.
X – The coordinates of the values in Z. X must be 2-D with the same shape as Z (e.g. created via
numpy.meshgrid
), or it must both be 1-D such thatlen(X) == M
is the number of columns in Z. If none, they are assumed to be integer indices, i.e.X = range(M)
.Y – The coordinates of the values in Z. Y must be 2-D with the same shape as Z (e.g. created via
numpy.meshgrid
), or it must both be 1-D such thatlen(Y) == N
is the number of rows in Z. If none, they are assumed to be integer indices, i.e.Y = range(N)
.
- Returns:
list of
ContourItem
objects
- histogram2D(X: ndarray, Y: ndarray, NX: int | None = None, NY: int | None = None, logscale: bool | None = None, title: str | None = None, transparent: bool | None = None, Z: ndarray | None = None, computation: int = -1, interpolation: int = 0, lock_position: bool = True) Histogram2DItem ¶
Make a 2D Histogram plot item
- Parameters:
X – X data
Y – Y data
NX – number of bins along x-axis. Default is None
NY – number of bins along y-axis. Default is None
logscale – Z-axis scale. Default is None
title – item title. Default is None
transparent – enable transparency. Default is None
Z – Z data. Default is None
computation – computation mode. Default is -1
interpolation – interpolation mode. Default is 0
lock_position – lock position. Default is True
- Returns:
Histogram2DItem
object
- rectangle(x0: float, y0: float, x1: float, y1: float, title: str | None = None) RectangleShape ¶
Make a rectangle shape plot item
- Parameters:
x0 – rectangle x0 coordinate
y0 – rectangle y0 coordinate
x1 – rectangle x1 coordinate
y1 – rectangle y1 coordinate
title – label name. Default is None
- Returns:
RectangleShape
object
- ellipse(x0: float, y0: float, x1: float, y1: float, x2: float | None = None, y2: float | None = None, x3: float | None = None, y3: float | None = None, title: str | None = None) EllipseShape ¶
Make an ellipse shape plot item
- Parameters:
x0 – ellipse x0 coordinate
y0 – ellipse y0 coordinate
x1 – ellipse x1 coordinate
y1 – ellipse y1 coordinate
x2 – ellipse x2 coordinate. Default is None
y2 – ellipse y2 coordinate. Default is None
x3 – ellipse x3 coordinate. Default is None
y3 – ellipse y3 coordinate. Default is None
title – label name. Default is None
- Returns:
EllipseShape
object
- polygon(x: ndarray, y: ndarray, closed: bool, title: str | None = None) PolygonShape ¶
Make a polygon shape plot item
- Parameters:
x – polygon x coordinates
y – polygon y coordinates
closed – closed polygon
title – label name. Default is None
- Returns:
PolygonShape
object
- circle(x0: float, y0: float, x1: float, y1: float, title: str | None = None) EllipseShape ¶
Make a circle shape plot item
- Parameters:
x0 – circle x0 coordinate
y0 – circle y0 coordinate
x1 – circle x1 coordinate
y1 – circle y1 coordinate
title – label name. Default is None
- Returns:
EllipseShape
object
- segment(x0: float, y0: float, x1: float, y1: float, title: str | None = None) SegmentShape ¶
Make a segment shape plot item
- Parameters:
x0 – segment x0 coordinate
y0 – segment y0 coordinate
x1 – segment x1 coordinate
y1 – segment y1 coordinate
title – label name. Default is None
- Returns:
SegmentShape
object
- svg(shape: str, fname_or_data: str | bytes, x0: float, y0: float, x1: float, y1: float, title: str | None = None)¶
Make a SVG shape plot item
- Parameters:
shape – shape type (“circle”, “rectangle”, “square”)
fname_or_data – filename or data
x0 – shape x0 coordinate
y0 – shape y0 coordinate
x1 – shape x1 coordinate
y1 – shape y1 coordinate
title – label name. Default is None
- Returns:
SVG shape
- annotated_point(x: float, y: float, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedPoint ¶
Make an annotated point plot item
- Parameters:
x – point x coordinate
y – point y coordinate
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedPoint
object
- annotated_rectangle(x0: float, y0: float, x1: float, y1: float, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedRectangle ¶
Make an annotated rectangle plot item
- Parameters:
x0 – rectangle x0 coordinate
y0 – rectangle y0 coordinate
x1 – rectangle x1 coordinate
y1 – rectangle y1 coordinate
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedRectangle
object
- annotated_ellipse(x0: float, y0: float, x1: float, y1: float, x2: float | None = None, y2: float | None = None, x3: float | None = None, y3: float | None = None, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedEllipse ¶
Make an annotated ellipse plot item
- Parameters:
x0 – ellipse x0 coordinate
y0 – ellipse y0 coordinate
x1 – ellipse x1 coordinate
y1 – ellipse y1 coordinate
x2 – ellipse x2 coordinate. Default is None
y2 – ellipse y2 coordinate. Default is None
x3 – ellipse x3 coordinate. Default is None
y3 – ellipse y3 coordinate. Default is None
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedEllipse
object
- annotated_circle(x0: float, y0: float, x1: float, y1: float, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedCircle ¶
Make an annotated circle plot item
- Parameters:
x0 – circle x0 coordinate
y0 – circle y0 coordinate
x1 – circle x1 coordinate
y1 – circle y1 coordinate
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedCircle
object
- annotated_segment(x0: float, y0: float, x1: float, y1: float, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedSegment ¶
Make an annotated segment plot item
- Parameters:
x0 – segment x0 coordinate
y0 – segment y0 coordinate
x1 – segment x1 coordinate
y1 – segment y1 coordinate
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedSegment
object
- annotated_polygon(points: ndarray, title: str | None = None, subtitle: str | None = None, show_label: bool | None = None, show_computations: bool | None = None, show_subtitle: bool | None = None, format: str | None = None, uncertainty: float | None = None, transform_matrix: ndarray | None = None, readonly: bool | None = None, private: bool | None = None) AnnotatedPolygon ¶
Make an annotated polygon plot item
- Parameters:
points – polygon points
title – label name. Default is None
subtitle – label subtitle. Default is None
show_label – show label. Default is None
show_computations – show computations. Default is None
show_subtitle – show subtitle. Default is None
format – string formatting. Default is None
uncertainty – measurement relative uncertainty. Default is None
transform_matrix – transform matrix. Default is None
readonly – readonly. Default is None
private – private. Default is None
- Returns:
AnnotatedPolygon
object
- label(text: str, g: tuple[float, float] | str, c: tuple[int, int], anchor: str, title: str = '') LabelItem ¶
Make a label plot item
- Parameters:
text – label text
g – position in plot coordinates or relative position (string)
c – position in canvas coordinates
anchor – anchor position in relative position (string)
title – label title. Default is ‘’
- Returns:
LabelItem
object
- Examples::
make.label(“Relative position”, (x[0], y[0]), (10, 10), “BR”) make.label(“Absolute position”, “R”, (0,0), “R”)
- legend(anchor: str = 'TR', c: tuple[int, int] | None = None, restrict_items: list | None = None) LegendBoxItem | SelectedLegendBoxItem ¶
Make a legend plot item
- Parameters:
anchor – legend position in relative position (string)
c – position in canvas coordinates
restrict_items – list of items to be shown in legend box. Default is None. If None, all items are shown in legend box. If [], no item is shown in legend box. If [item1, item2], item1, item2 are shown in legend box.
- Returns:
LegendBoxItem
orSelectedLegendBoxItem
object
- info_label(anchor: str, comps: list, title: str | None = None) DataInfoLabel ¶
Make an info label plot item
- Parameters:
anchor – anchor position. See
LabelParam
for detailscomps – list of
label.RangeComputation
objectstitle – label name. Default is None
- Returns:
DataInfoLabel
object
- range_info_label(range: XRangeSelection, anchor: str, label: str, function: Callable = None, title: str | None = None) DataInfoLabel ¶
Make an info label plot item showing an XRangeSelection object infos
- Parameters:
range – range selection object
anchor – anchor position. See
LabelParam
for detailslabel – label name. See
DataInfoLabel
for detailsfunction – function to apply to the range selection object Default is None (default function is lambda x, dx: (x, dx))
title – label name. Default is None
- Returns:
DataInfoLabel
object
Example:
x = linspace(-10, 10, 10) y = sin(sin(sin(x))) range = make.range(-2, 2) disp = make.range_info_label(range, 'BL', "x = %.1f ± %.1f cm", lambda x, dx: (x, dx))
- computation(range: XRangeSelection, anchor: str, label: str, curve: CurveItem, function: Callable, title: str | None = None) DataInfoLabel ¶
Make a computation label plot item
- Parameters:
range – range selection object
anchor – anchor position. See
LabelParam
for detailslabel – label name. See
DataInfoLabel
for detailscurve – curve item
function – function to apply to the range selection object Default is None (default function is lambda x, dx: (x, dx))
- Returns:
DataInfoLabel
object
- computations(range: XRangeSelection, anchor: str, specs: list, title: str | None = None) DataInfoLabel ¶
Make computation labels plot item
- Parameters:
range – range selection object
anchor – anchor position. See
LabelParam
for detailsspecs – list of (curve, label, function) tuples
title – label name. Default is None
- Returns:
Data info label object
- computation2d(rect: RectangleShape, anchor: str, label: str, image: ImageItem, function: Callable, title: str | None = None) DataInfoLabel ¶
Make a 2D computation label plot item
- Parameters:
rect – rectangle selection object
anchor – anchor position. See
LabelParam
for detailslabel – label name. See
DataInfoLabel
for detailsimage – image item
function – function to apply to the rectangle selection object Default is None (default function is lambda x, dx: (x, dx))
title – label name. Default is None
- Returns:
Data info label object
- computations2d(rect: RectangleShape, anchor: str, specs: list, title: str | None = None) DataInfoLabel ¶
Make 2D computation labels plot item
- Parameters:
rect – rectangle selection object
anchor – anchor position. See
LabelParam
for detailsspecs – list of (image, label, function) tuples
title – label name. Default is None
- Returns:
Data info label object