plotpy.label¶
- The labels module provides plot items related to labels and legends:
plotpy.shapes.LabelItem
plotpy.shapes.LegendBoxItem
plotpy.shapes.SelectedLegendBoxItem
plotpy.shapes.RangeComputation
plotpy.shapes.RangeComputation2d
plotpy.shapes.DataInfoLabel
A label or a legend is a plot item (derived from QwtPlotItem) that may be
displayed on a 2D plotting widget like plotpy.curve.CurvePlot
or plotpy.image.ImagePlot
.
Reference¶
-
class
plotpy.label.
LabelItem
(text=None, labelparam=None)[source]¶ -
-
attach
(plot)¶ Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a None argument is passed, it will detach from any QwtPlot it was attached to.
Parameters: plot (qwt.plot.QwtPlot) – Plot widget See also
-
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
-
defaultIcon
(brush, size)¶ Return a default icon from a brush
The default icon is a filled rectangle used in several derived classes as legendIcon().
Parameters: - brush (QBrush) – Fill brush
- size (QSizeF) – Icon size
Returns: A filled rectangle
-
detach
()¶ Detach the item from a plot.
This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
See also
-
getCanvasMarginHint
(xMap, yMap, canvasRect)¶ Calculate a hint for the canvas margin
When the QwtPlotItem::Margins flag is enabled the plot item indicates, that it needs some margins at the borders of the canvas. This is f.e. used by bar charts to reserve space for displaying the bars.
The margins are in target device coordinates ( pixels on screen )
Parameters: - 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 in painter coordinates
See also
QwtPlot.getCanvasMarginsHint()
,QwtPlot.updateCanvasMargins()
,
-
hide
()¶ Hide the item
-
isVisible
()¶ Returns: True if visible See also
-
is_private
()¶ Return True if object is private
-
is_readonly
()¶ Return object readonly state
-
itemChanged
()¶ Update the legend and call QwtPlot.autoRefresh() for the parent plot.
See also
QwtPlot.legendChanged()
,QwtPlot.autoRefresh()
-
legendChanged
()¶ Update the legend of the parent plot.
See also
QwtPlot.updateLegend()
,itemChanged()
-
legendData
()¶ Return all information, that is needed to represent the item on the legend
QwtLegendData is basically a list of QVariants that makes it possible to overload and reimplement legendData() to return almost any type of information, that is understood by the receiver that acts as the legend.
The default implementation returns one entry with the title() of the item and the legendIcon().
Returns: Data, that is needed to represent the item on the legend See also
title()
,legendIcon()
,qwt.legend.QwtLegend
-
legendIcon
(index, size)¶ Parameters: - index (int) – Index of the legend entry (usually there is only one)
- size (QSizeF) – Icon size
Returns: Icon representing the item on the legend
The default implementation returns an invalid icon
See also
-
legendIconSize
()¶ Returns: Legend icon size See also
-
move_local_point_to
(handle, pos, ctrl=None)¶ Move a handle as returned by hit_test to the new position pos ctrl: True if <Ctrl> button is being pressed, False otherwise
-
move_local_shape
(old_pos, new_pos)¶ Translate the shape such that old_pos becomes new_pos in canvas coordinates
-
move_with_selection
(delta_x, delta_y)¶ Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates
-
paintRect
(xMap, yMap)¶ Calculate the bounding paint rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding paint rectangle of the scale maps, not normalized
-
plot
()¶ Returns: attached plot
-
rtti
()¶ Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.
Returns: rtti value
-
scaleRect
(xMap, yMap)¶ Calculate the bounding scale rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding scale rect of the scale maps, not normalized
-
select
()¶ Select item
-
setAxes
(xAxis, yAxis)¶ Set X and Y axis
The item will painted according to the coordinates of its Axes.
Parameters: - xAxis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop)
- yAxis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight)
See also
-
setAxis
(xAxis, yAxis)¶ Set X and Y axis
Warning
setAxis has been removed in Qwt6: please use
setAxes()
instead
-
setItemAttribute
(attribute, on=True)¶ Toggle an item attribute
Parameters: - attribute (int) – Attribute type
- on (bool) – True/False
See also
-
setItemInterest
(interest, on=True)¶ Toggle an item interest
Parameters: - attribute (int) – Interest type
- on (bool) – True/False
See also
-
setLegendIconSize
(size)¶ Set the size of the legend icon
The default setting is 8x8 pixels
Parameters: size (QSize) – Size See also
-
setRenderHint
(hint, on=True)¶ Toggle a render hint
Parameters: - hint (int) – Render hint
- on (bool) – True/False
See also
-
setTitle
(title)¶ Set a new title
Parameters: title (qwt.text.QwtText or str) – Title See also
-
setVisible
(on)¶ Show/Hide the item
Parameters: on (bool) – Show if True, otherwise hide See also
-
setXAxis
(axis)¶ Set the X axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop) See also
-
setYAxis
(axis)¶ Set the Y axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight) See also
-
setZ
(z)¶ Set the z value
Plot items are painted in increasing z-order.
Parameters: z (float) – Z-value See also
z()
,QwtPlotDict.itemList()
-
set_movable
(state)¶ Set item movable state
-
set_private
(state)¶ Set object as private
-
set_readonly
(state)¶ Set object readonly state
-
set_resizable
(state)¶ Set item resizable state (or any action triggered when moving an handle, e.g. rotation)
-
set_rotatable
(state)¶ Set item rotatable state
-
set_selectable
(state)¶ Set item selectable state
-
show
()¶ Show the item
-
testItemAttribute
(attribute)¶ Test an item attribute
Parameters: attribute (int) – Attribute type Returns: True/False See also
-
testItemInterest
(interest)¶ Test an item interest
Parameters: attribute (int) – Interest type Returns: True/False See also
-
testRenderHint
(hint)¶ Test a render hint
Parameters: attribute (int) – Render hint Returns: True/False See also
-
title
()¶ Returns: Title of the item See also
-
unselect
()¶ Unselect item
-
updateLegend
(item, data)¶ Update the item to changes of the legend info
Plot items that want to display a legend ( not those, that want to be displayed on a legend ! ) will have to implement updateLegend().
updateLegend() is only called when the LegendInterest interest is enabled. The default implementation does nothing.
Parameters: - item (qwt.plot.QwtPlotItem) – Plot item to be displayed on a legend
- data (list) – Attributes how to display item on the legend
Note
Plot items, that want to be displayed on a legend need to enable the QwtPlotItem.Legend flag and to implement legendData() and legendIcon()
-
xAxis
()¶ Returns: xAxis
-
yAxis
()¶ Returns: yAxis
-
-
class
plotpy.label.
LegendBoxItem
(labelparam=None)[source]¶ -
attach
(plot)¶ Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a None argument is passed, it will detach from any QwtPlot it was attached to.
Parameters: plot (qwt.plot.QwtPlot) – Plot widget See also
-
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
-
defaultIcon
(brush, size)¶ Return a default icon from a brush
The default icon is a filled rectangle used in several derived classes as legendIcon().
Parameters: - brush (QBrush) – Fill brush
- size (QSizeF) – Icon size
Returns: A filled rectangle
-
deserialize
(reader)¶ Deserialize object from HDF5 reader
-
detach
()¶ Detach the item from a plot.
This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
See also
-
getCanvasMarginHint
(xMap, yMap, canvasRect)¶ Calculate a hint for the canvas margin
When the QwtPlotItem::Margins flag is enabled the plot item indicates, that it needs some margins at the borders of the canvas. This is f.e. used by bar charts to reserve space for displaying the bars.
The margins are in target device coordinates ( pixels on screen )
Parameters: - 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 in painter coordinates
See also
QwtPlot.getCanvasMarginsHint()
,QwtPlot.updateCanvasMargins()
,
-
hide
()¶ Hide the item
-
isVisible
()¶ Returns: True if visible See also
-
is_private
()¶ Return True if object is private
-
is_readonly
()¶ Return object readonly state
-
itemChanged
()¶ Update the legend and call QwtPlot.autoRefresh() for the parent plot.
See also
QwtPlot.legendChanged()
,QwtPlot.autoRefresh()
-
legendChanged
()¶ Update the legend of the parent plot.
See also
QwtPlot.updateLegend()
,itemChanged()
-
legendData
()¶ Return all information, that is needed to represent the item on the legend
QwtLegendData is basically a list of QVariants that makes it possible to overload and reimplement legendData() to return almost any type of information, that is understood by the receiver that acts as the legend.
The default implementation returns one entry with the title() of the item and the legendIcon().
Returns: Data, that is needed to represent the item on the legend See also
title()
,legendIcon()
,qwt.legend.QwtLegend
-
legendIcon
(index, size)¶ Parameters: - index (int) – Index of the legend entry (usually there is only one)
- size (QSizeF) – Icon size
Returns: Icon representing the item on the legend
The default implementation returns an invalid icon
See also
-
legendIconSize
()¶ Returns: Legend icon size See also
-
move_local_point_to
(handle, pos, ctrl=None)¶ Move a handle as returned by hit_test to the new position pos ctrl: True if <Ctrl> button is being pressed, False otherwise
-
move_local_shape
(old_pos, new_pos)¶ Translate the shape such that old_pos becomes new_pos in canvas coordinates
-
move_with_selection
(delta_x, delta_y)¶ Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates
-
paintRect
(xMap, yMap)¶ Calculate the bounding paint rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding paint rectangle of the scale maps, not normalized
-
plot
()¶ Returns: attached plot
-
rtti
()¶ Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.
Returns: rtti value
-
scaleRect
(xMap, yMap)¶ Calculate the bounding scale rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding scale rect of the scale maps, not normalized
-
select
()¶ Select item
-
serialize
(writer)¶ Serialize object to HDF5 writer
-
setAxes
(xAxis, yAxis)¶ Set X and Y axis
The item will painted according to the coordinates of its Axes.
Parameters: - xAxis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop)
- yAxis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight)
See also
-
setAxis
(xAxis, yAxis)¶ Set X and Y axis
Warning
setAxis has been removed in Qwt6: please use
setAxes()
instead
-
setItemAttribute
(attribute, on=True)¶ Toggle an item attribute
Parameters: - attribute (int) – Attribute type
- on (bool) – True/False
See also
-
setItemInterest
(interest, on=True)¶ Toggle an item interest
Parameters: - attribute (int) – Interest type
- on (bool) – True/False
See also
-
setLegendIconSize
(size)¶ Set the size of the legend icon
The default setting is 8x8 pixels
Parameters: size (QSize) – Size See also
-
setRenderHint
(hint, on=True)¶ Toggle a render hint
Parameters: - hint (int) – Render hint
- on (bool) – True/False
See also
-
setTitle
(title)¶ Set a new title
Parameters: title (qwt.text.QwtText or str) – Title See also
-
setVisible
(on)¶ Show/Hide the item
Parameters: on (bool) – Show if True, otherwise hide See also
-
setXAxis
(axis)¶ Set the X axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop) See also
-
setYAxis
(axis)¶ Set the Y axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight) See also
-
setZ
(z)¶ Set the z value
Plot items are painted in increasing z-order.
Parameters: z (float) – Z-value See also
z()
,QwtPlotDict.itemList()
-
set_movable
(state)¶ Set item movable state
-
set_private
(state)¶ Set object as private
-
set_readonly
(state)¶ Set object readonly state
-
set_resizable
(state)¶ Set item resizable state (or any action triggered when moving an handle, e.g. rotation)
-
set_rotatable
(state)¶ Set item rotatable state
-
set_selectable
(state)¶ Set item selectable state
-
show
()¶ Show the item
-
testItemAttribute
(attribute)¶ Test an item attribute
Parameters: attribute (int) – Attribute type Returns: True/False See also
-
testItemInterest
(interest)¶ Test an item interest
Parameters: attribute (int) – Interest type Returns: True/False See also
-
testRenderHint
(hint)¶ Test a render hint
Parameters: attribute (int) – Render hint Returns: True/False See also
-
title
()¶ Returns: Title of the item See also
-
unselect
()¶ Unselect item
-
updateLegend
(item, data)¶ Update the item to changes of the legend info
Plot items that want to display a legend ( not those, that want to be displayed on a legend ! ) will have to implement updateLegend().
updateLegend() is only called when the LegendInterest interest is enabled. The default implementation does nothing.
Parameters: - item (qwt.plot.QwtPlotItem) – Plot item to be displayed on a legend
- data (list) – Attributes how to display item on the legend
Note
Plot items, that want to be displayed on a legend need to enable the QwtPlotItem.Legend flag and to implement legendData() and legendIcon()
-
xAxis
()¶ Returns: xAxis
-
yAxis
()¶ Returns: yAxis
-
-
class
plotpy.label.
SelectedLegendBoxItem
(dataset=None, itemlist=None)[source]¶ -
attach
(plot)¶ Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a None argument is passed, it will detach from any QwtPlot it was attached to.
Parameters: plot (qwt.plot.QwtPlot) – Plot widget See also
-
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
-
defaultIcon
(brush, size)¶ Return a default icon from a brush
The default icon is a filled rectangle used in several derived classes as legendIcon().
Parameters: - brush (QBrush) – Fill brush
- size (QSizeF) – Icon size
Returns: A filled rectangle
-
deserialize
(reader)¶ Deserialize object from HDF5 reader
-
detach
()¶ Detach the item from a plot.
This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
See also
-
getCanvasMarginHint
(xMap, yMap, canvasRect)¶ Calculate a hint for the canvas margin
When the QwtPlotItem::Margins flag is enabled the plot item indicates, that it needs some margins at the borders of the canvas. This is f.e. used by bar charts to reserve space for displaying the bars.
The margins are in target device coordinates ( pixels on screen )
Parameters: - 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 in painter coordinates
See also
QwtPlot.getCanvasMarginsHint()
,QwtPlot.updateCanvasMargins()
,
-
hide
()¶ Hide the item
-
isVisible
()¶ Returns: True if visible See also
-
is_private
()¶ Return True if object is private
-
is_readonly
()¶ Return object readonly state
-
itemChanged
()¶ Update the legend and call QwtPlot.autoRefresh() for the parent plot.
See also
QwtPlot.legendChanged()
,QwtPlot.autoRefresh()
-
legendChanged
()¶ Update the legend of the parent plot.
See also
QwtPlot.updateLegend()
,itemChanged()
-
legendData
()¶ Return all information, that is needed to represent the item on the legend
QwtLegendData is basically a list of QVariants that makes it possible to overload and reimplement legendData() to return almost any type of information, that is understood by the receiver that acts as the legend.
The default implementation returns one entry with the title() of the item and the legendIcon().
Returns: Data, that is needed to represent the item on the legend See also
title()
,legendIcon()
,qwt.legend.QwtLegend
-
legendIcon
(index, size)¶ Parameters: - index (int) – Index of the legend entry (usually there is only one)
- size (QSizeF) – Icon size
Returns: Icon representing the item on the legend
The default implementation returns an invalid icon
See also
-
legendIconSize
()¶ Returns: Legend icon size See also
-
move_local_point_to
(handle, pos, ctrl=None)¶ Move a handle as returned by hit_test to the new position pos ctrl: True if <Ctrl> button is being pressed, False otherwise
-
move_local_shape
(old_pos, new_pos)¶ Translate the shape such that old_pos becomes new_pos in canvas coordinates
-
move_with_selection
(delta_x, delta_y)¶ Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates
-
paintRect
(xMap, yMap)¶ Calculate the bounding paint rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding paint rectangle of the scale maps, not normalized
-
plot
()¶ Returns: attached plot
-
rtti
()¶ Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.
Returns: rtti value
-
scaleRect
(xMap, yMap)¶ Calculate the bounding scale rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding scale rect of the scale maps, not normalized
-
select
()¶ Select item
-
serialize
(writer)¶ Serialize object to HDF5 writer
-
setAxes
(xAxis, yAxis)¶ Set X and Y axis
The item will painted according to the coordinates of its Axes.
Parameters: - xAxis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop)
- yAxis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight)
See also
-
setAxis
(xAxis, yAxis)¶ Set X and Y axis
Warning
setAxis has been removed in Qwt6: please use
setAxes()
instead
-
setItemAttribute
(attribute, on=True)¶ Toggle an item attribute
Parameters: - attribute (int) – Attribute type
- on (bool) – True/False
See also
-
setItemInterest
(interest, on=True)¶ Toggle an item interest
Parameters: - attribute (int) – Interest type
- on (bool) – True/False
See also
-
setLegendIconSize
(size)¶ Set the size of the legend icon
The default setting is 8x8 pixels
Parameters: size (QSize) – Size See also
-
setRenderHint
(hint, on=True)¶ Toggle a render hint
Parameters: - hint (int) – Render hint
- on (bool) – True/False
See also
-
setTitle
(title)¶ Set a new title
Parameters: title (qwt.text.QwtText or str) – Title See also
-
setVisible
(on)¶ Show/Hide the item
Parameters: on (bool) – Show if True, otherwise hide See also
-
setXAxis
(axis)¶ Set the X axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop) See also
-
setYAxis
(axis)¶ Set the Y axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight) See also
-
setZ
(z)¶ Set the z value
Plot items are painted in increasing z-order.
Parameters: z (float) – Z-value See also
z()
,QwtPlotDict.itemList()
-
set_movable
(state)¶ Set item movable state
-
set_private
(state)¶ Set object as private
-
set_readonly
(state)¶ Set object readonly state
-
set_resizable
(state)¶ Set item resizable state (or any action triggered when moving an handle, e.g. rotation)
-
set_rotatable
(state)¶ Set item rotatable state
-
set_selectable
(state)¶ Set item selectable state
-
show
()¶ Show the item
-
testItemAttribute
(attribute)¶ Test an item attribute
Parameters: attribute (int) – Attribute type Returns: True/False See also
-
testItemInterest
(interest)¶ Test an item interest
Parameters: attribute (int) – Interest type Returns: True/False See also
-
testRenderHint
(hint)¶ Test a render hint
Parameters: attribute (int) – Render hint Returns: True/False See also
-
title
()¶ Returns: Title of the item See also
-
unselect
()¶ Unselect item
-
updateLegend
(item, data)¶ Update the item to changes of the legend info
Plot items that want to display a legend ( not those, that want to be displayed on a legend ! ) will have to implement updateLegend().
updateLegend() is only called when the LegendInterest interest is enabled. The default implementation does nothing.
Parameters: - item (qwt.plot.QwtPlotItem) – Plot item to be displayed on a legend
- data (list) – Attributes how to display item on the legend
Note
Plot items, that want to be displayed on a legend need to enable the QwtPlotItem.Legend flag and to implement legendData() and legendIcon()
-
xAxis
()¶ Returns: xAxis
-
yAxis
()¶ Returns: yAxis
-
-
class
plotpy.label.
RangeComputation
(label, curve, xrangeselection, function=None)[source]¶ ObjectInfo showing curve computations relative to a XRangeSelection shape.
label: formatted string curve: CurveItem object xrangeselection: XRangeSelection object function: input arguments are x, y arrays (extraction of arrays corresponding to the xrangeselection X-axis range)
-
class
plotpy.label.
DataInfoLabel
(labelparam=None, infos=None)[source]¶ -
attach
(plot)¶ Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a None argument is passed, it will detach from any QwtPlot it was attached to.
Parameters: plot (qwt.plot.QwtPlot) – Plot widget See also
-
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
-
defaultIcon
(brush, size)¶ Return a default icon from a brush
The default icon is a filled rectangle used in several derived classes as legendIcon().
Parameters: - brush (QBrush) – Fill brush
- size (QSizeF) – Icon size
Returns: A filled rectangle
-
deserialize
(reader)¶ Deserialize object from HDF5 reader
-
detach
()¶ Detach the item from a plot.
This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
See also
-
getCanvasMarginHint
(xMap, yMap, canvasRect)¶ Calculate a hint for the canvas margin
When the QwtPlotItem::Margins flag is enabled the plot item indicates, that it needs some margins at the borders of the canvas. This is f.e. used by bar charts to reserve space for displaying the bars.
The margins are in target device coordinates ( pixels on screen )
Parameters: - 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 in painter coordinates
See also
QwtPlot.getCanvasMarginsHint()
,QwtPlot.updateCanvasMargins()
,
-
hide
()¶ Hide the item
-
isVisible
()¶ Returns: True if visible See also
-
is_private
()¶ Return True if object is private
-
is_readonly
()¶ Return object readonly state
-
itemChanged
()¶ Update the legend and call QwtPlot.autoRefresh() for the parent plot.
See also
QwtPlot.legendChanged()
,QwtPlot.autoRefresh()
-
legendChanged
()¶ Update the legend of the parent plot.
See also
QwtPlot.updateLegend()
,itemChanged()
-
legendData
()¶ Return all information, that is needed to represent the item on the legend
QwtLegendData is basically a list of QVariants that makes it possible to overload and reimplement legendData() to return almost any type of information, that is understood by the receiver that acts as the legend.
The default implementation returns one entry with the title() of the item and the legendIcon().
Returns: Data, that is needed to represent the item on the legend See also
title()
,legendIcon()
,qwt.legend.QwtLegend
-
legendIcon
(index, size)¶ Parameters: - index (int) – Index of the legend entry (usually there is only one)
- size (QSizeF) – Icon size
Returns: Icon representing the item on the legend
The default implementation returns an invalid icon
See also
-
legendIconSize
()¶ Returns: Legend icon size See also
-
move_local_point_to
(handle, pos, ctrl=None)¶ Move a handle as returned by hit_test to the new position pos ctrl: True if <Ctrl> button is being pressed, False otherwise
-
move_local_shape
(old_pos, new_pos)¶ Translate the shape such that old_pos becomes new_pos in canvas coordinates
-
move_with_selection
(delta_x, delta_y)¶ Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates
-
paintRect
(xMap, yMap)¶ Calculate the bounding paint rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding paint rectangle of the scale maps, not normalized
-
plot
()¶ Returns: attached plot
-
rtti
()¶ Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.
Returns: rtti value
-
scaleRect
(xMap, yMap)¶ Calculate the bounding scale rectangle of 2 maps
Parameters: - xMap (qwt.scale_map.QwtScaleMap) – Maps x-values into pixel coordinates.
- yMap (qwt.scale_map.QwtScaleMap) – Maps y-values into pixel coordinates.
Returns: Bounding scale rect of the scale maps, not normalized
-
select
()¶ Select item
-
serialize
(writer)¶ Serialize object to HDF5 writer
-
setAxes
(xAxis, yAxis)¶ Set X and Y axis
The item will painted according to the coordinates of its Axes.
Parameters: - xAxis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop)
- yAxis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight)
See also
-
setAxis
(xAxis, yAxis)¶ Set X and Y axis
Warning
setAxis has been removed in Qwt6: please use
setAxes()
instead
-
setItemAttribute
(attribute, on=True)¶ Toggle an item attribute
Parameters: - attribute (int) – Attribute type
- on (bool) – True/False
See also
-
setItemInterest
(interest, on=True)¶ Toggle an item interest
Parameters: - attribute (int) – Interest type
- on (bool) – True/False
See also
-
setLegendIconSize
(size)¶ Set the size of the legend icon
The default setting is 8x8 pixels
Parameters: size (QSize) – Size See also
-
setRenderHint
(hint, on=True)¶ Toggle a render hint
Parameters: - hint (int) – Render hint
- on (bool) – True/False
See also
-
setTitle
(title)¶ Set a new title
Parameters: title (qwt.text.QwtText or str) – Title See also
-
setVisible
(on)¶ Show/Hide the item
Parameters: on (bool) – Show if True, otherwise hide See also
-
setXAxis
(axis)¶ Set the X axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – X Axis (QwtPlot.xBottom or QwtPlot.xTop) See also
-
setYAxis
(axis)¶ Set the Y axis
The item will painted according to the coordinates its Axes.
Parameters: axis (int) – Y Axis (QwtPlot.yLeft or QwtPlot.yRight) See also
-
setZ
(z)¶ Set the z value
Plot items are painted in increasing z-order.
Parameters: z (float) – Z-value See also
z()
,QwtPlotDict.itemList()
-
set_movable
(state)¶ Set item movable state
-
set_private
(state)¶ Set object as private
-
set_readonly
(state)¶ Set object readonly state
-
set_resizable
(state)¶ Set item resizable state (or any action triggered when moving an handle, e.g. rotation)
-
set_rotatable
(state)¶ Set item rotatable state
-
set_selectable
(state)¶ Set item selectable state
-
show
()¶ Show the item
-
testItemAttribute
(attribute)¶ Test an item attribute
Parameters: attribute (int) – Attribute type Returns: True/False See also
-
testItemInterest
(interest)¶ Test an item interest
Parameters: attribute (int) – Interest type Returns: True/False See also
-
testRenderHint
(hint)¶ Test a render hint
Parameters: attribute (int) – Render hint Returns: True/False See also
-
title
()¶ Returns: Title of the item See also
-
unselect
()¶ Unselect item
-
updateLegend
(item, data)¶ Update the item to changes of the legend info
Plot items that want to display a legend ( not those, that want to be displayed on a legend ! ) will have to implement updateLegend().
updateLegend() is only called when the LegendInterest interest is enabled. The default implementation does nothing.
Parameters: - item (qwt.plot.QwtPlotItem) – Plot item to be displayed on a legend
- data (list) – Attributes how to display item on the legend
Note
Plot items, that want to be displayed on a legend need to enable the QwtPlotItem.Legend flag and to implement legendData() and legendIcon()
-
xAxis
()¶ Returns: xAxis
-
yAxis
()¶ Returns: yAxis
-