guiqwt.annotations

The annotations module provides annotated shapes:

An annotated shape is a plot item (derived from QwtPlotItem) that may be displayed on a 2D plotting widget like guiqwt.curve.CurvePlot or guiqwt.image.ImagePlot.

See also

module guiqwt.shapes

Examples

An annotated shape may be created:
  • from the associated plot item class (e.g. AnnotatedCircle to create an annotated circle): the item properties are then assigned by creating the appropriate style parameters object (guiqwt.styles.AnnotationParam)

>>> from guiqwt.annotations import AnnotatedCircle
>>> from guiqwt.styles import AnnotationParam
>>> param = AnnotationParam()
>>> param.title = 'My circle'
>>> circle_item = AnnotatedCircle(0., 2., 4., 0., param)
  • or using the plot item builder (see guiqwt.builder.make()):

>>> from guiqwt.builder import make
>>> circle_item = make.annotated_circle(0., 2., 4., 0., title='My circle')

Reference

class guiqwt.annotations.AnnotatedPoint(x=0, y=0, annotationparam=None)[source]

Construct an annotated point at coordinates (x, y) with properties set with annotationparam (see guiqwt.styles.AnnotationParam)

SHAPE_CLASS

alias of guiqwt.shapes.PointShape

set_pos(x, y)[source]

Set the point coordinates to (x, y)

get_pos()[source]

Return the point coordinates

create_shape()[source]

Return the shape object associated to this annotated shape object

set_label_position()[source]

Set label position, for instance based on shape position

get_infos()[source]

Return formatted string with informations on current shape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_center()

Return shape center coordinates after applying transform matrix

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size()

Return shape size after applying transform matrix

get_tr_size_str()

Return size as a string (with units)

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_visible(state)

Set the annotated shape’s label visibility

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

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.annotations.AnnotatedSegment(x1=0, y1=0, x2=0, y2=0, annotationparam=None)[source]

Construct an annotated segment between coordinates (x1, y1) and (x2, y2) with properties set with annotationparam (see guiqwt.styles.AnnotationParam)

SHAPE_CLASS

alias of guiqwt.shapes.SegmentShape

set_rect(x1, y1, x2, y2)[source]

Set the coordinates of the shape’s top-left corner to (x1, y1), and of its bottom-right corner to (x2, y2).

get_rect()[source]

Return the coordinates of the shape’s top-left and bottom-right corners

get_tr_length()[source]

Return segment length after applying transform matrix

set_label_position()[source]

Set label position, for instance based on shape position

get_infos()[source]

Return formatted string with informations on current shape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

create_shape()

Return the shape object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_center()

Return shape center coordinates after applying transform matrix

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size()

Return shape size after applying transform matrix

get_tr_size_str()

Return size as a string (with units)

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_visible(state)

Set the annotated shape’s label visibility

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

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.annotations.AnnotatedRectangle(x1=0, y1=0, x2=0, y2=0, annotationparam=None)[source]

Construct an annotated rectangle between coordinates (x1, y1) and (x2, y2) with properties set with annotationparam (see guiqwt.styles.AnnotationParam)

SHAPE_CLASS

alias of guiqwt.shapes.RectangleShape

set_rect(x1, y1, x2, y2)[source]

Set the coordinates of the shape’s top-left corner to (x1, y1), and of its bottom-right corner to (x2, y2).

get_rect()[source]

Return the coordinates of the shape’s top-left and bottom-right corners

set_label_position()[source]

Set label position, for instance based on shape position

get_computations_text()[source]

Return formatted string with informations on current shape

get_tr_center()[source]

Return shape center coordinates after applying transform matrix

get_tr_size()[source]

Return shape size after applying transform matrix

get_infos()[source]

Return formatted string with informations on current shape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

create_shape()

Return the shape object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size_str()

Return size as a string (with units)

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_visible(state)

Set the annotated shape’s label visibility

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

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.annotations.AnnotatedObliqueRectangle(x0=0, y0=0, x1=0, y1=0, x2=0, y2=0, x3=0, y3=0, annotationparam=None)[source]

Construct an annotated oblique rectangle between coordinates (x0, y0), (x1, y1), (x2, y2) and (x3, y3) with properties set with annotationparam (see guiqwt.styles.AnnotationParam)

SHAPE_CLASS

alias of guiqwt.shapes.ObliqueRectangleShape

get_tr_angle()[source]

Return X-diameter angle with horizontal direction, after applying transform matrix

get_bounding_rect_coords()[source]

Return bounding rectangle coordinates (in plot coordinates)

create_shape()[source]

Return the shape object associated to this annotated shape object

set_label_position()[source]

Set label position, for instance based on shape position

set_rect(x0, y0, x1, y1, x2, y2, x3, y3)[source]

Set the rectangle corners coordinates:

(x0, y0): top-left corner (x1, y1): top-right corner (x2, y2): bottom-right corner (x3, y3): bottom-left corner

x: additionnal points

(x0, y0)------>(x1, y1)
    ↑             |
    |             |
    x             x
    |             |
    |             ↓
(x3, y3)<------(x2, y2)
get_tr_size()[source]

Return shape size after applying transform matrix

get_infos()[source]

Return formatted string with informations on current shape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_computations_text()

Return formatted string with informations on current shape

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_rect()

Return the coordinates of the shape’s top-left and bottom-right corners

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_center()

Return shape center coordinates after applying transform matrix

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size_str()

Return size as a string (with units)

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_visible(state)

Set the annotated shape’s label visibility

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

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.annotations.AnnotatedEllipse(x1=0, y1=0, x2=0, y2=0, annotationparam=None)[source]

Construct an annotated ellipse with X-axis diameter between coordinates (x1, y1) and (x2, y2) and properties set with annotationparam (see guiqwt.styles.AnnotationParam)

SHAPE_CLASS

alias of guiqwt.shapes.EllipseShape

set_xdiameter(x0, y0, x1, y1)[source]

Set the coordinates of the ellipse’s X-axis diameter Warning: transform matrix is not applied here

get_xdiameter()[source]

Return the coordinates of the ellipse’s X-axis diameter Warning: transform matrix is not applied here

set_ydiameter(x2, y2, x3, y3)[source]

Set the coordinates of the ellipse’s Y-axis diameter Warning: transform matrix is not applied here

get_ydiameter()[source]

Return the coordinates of the ellipse’s Y-axis diameter Warning: transform matrix is not applied here

get_tr_angle()[source]

Return X-diameter angle with horizontal direction, after applying transform matrix

set_label_position()[source]

Set label position, for instance based on shape position

get_tr_center()[source]

Return center coordinates: (xc, yc)

get_tr_size()[source]

Return shape size after applying transform matrix

get_infos()[source]

Return formatted string with informations on current shape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

create_shape()

Return the shape object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size_str()

Return size as a string (with units)

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_visible(state)

Set the annotated shape’s label visibility

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

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.annotations.AnnotatedCircle(x1=0, y1=0, x2=0, y2=0, annotationparam=None)[source]

Construct an annotated circle with diameter between coordinates (x1, y1) and (x2, y2) and properties set with annotationparam (see guiqwt.styles.AnnotationParam)

get_tr_diameter()[source]

Return circle diameter after applying transform matrix

get_infos()[source]

Return formatted string with informations on current shape

SHAPE_CLASS

alias of guiqwt.shapes.EllipseShape

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

detach()

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

create_label()

Return the label object associated to this annotated shape object

create_shape()

Return the shape object associated to this annotated shape object

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

attach()

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(),

get_center()

Return shape center coordinates: (xc, yc)

get_item_parameters(itemparams)

Appends datasets to the list of DataSets describing the parameters used to customize apearance of this item

get_text()

Return text associated to current shape (see guiqwt.label.ObjectInfo)

get_tr_angle()

Return X-diameter angle with horizontal direction, after applying transform matrix

get_tr_center()

Return center coordinates: (xc, yc)

get_tr_center_str()

Return center coordinates as a string (with units)

get_tr_size()

Return shape size after applying transform matrix

get_tr_size_str()

Return size as a string (with units)

get_xdiameter()

Return the coordinates of the ellipse’s X-axis diameter Warning: transform matrix is not applied here

get_ydiameter()

Return the coordinates of the ellipse’s Y-axis diameter Warning: transform matrix is not applied here

hide()

Hide the item

hit_test(pos)

Return a tuple with four elements: (distance, attach point, inside, other_object)

distancedistance in pixels (canvas coordinates)

to the closest attach point

attach point: handle of the attach point inside: True if the mouse button has been clicked inside the object other_object: if not None, reference of the object which

will be considered as hit instead of self

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if visible

is_label_visible()

Return True if associated label is visible

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

legendIconSize()
Returns

Legend icon size

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_shape(old_pos, new_pos)

Translate the shape such that old_pos becomes new_pos in axis 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)

setAxis(xAxis, yAxis)

Set X and Y axis

Warning

setAxis has been removed in Qwt6: please use setAxes() instead

setIcon(icon)

Set item icon

Parameters

icon (QIcon) – Icon

See also

icon()

setItemAttribute(attribute, on=True)

Toggle an item attribute

Parameters
  • attribute (int) – Attribute type

  • on (bool) – True/False

setItemInterest(interest, on=True)

Toggle an item interest

Parameters
  • attribute (int) – Interest type

  • on (bool) – True/False

setLegendIconSize(size)

Set the size of the legend icon

The default setting is 8x8 pixels

Parameters

size (QSize) – Size

setRenderHint(hint, on=True)

Toggle a render hint

Parameters
  • hint (int) – Render hint

  • on (bool) – True/False

See also

testRenderHint()

setTitle(title)

Set a new title

Parameters

title (qwt.text.QwtText or str) – Title

See also

title()

setVisible(on)

Show/Hide the item

Parameters

on (bool) – Show if True, otherwise hide

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)

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)

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_item_parameters(itemparams)

Change the appearance of this item according to the parameter set provided

params is a list of Datasets of the same types as those returned by get_item_parameters

set_label_position()

Set label position, for instance based on shape position

set_label_visible(state)

Set the annotated shape’s label visibility

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

set_xdiameter(x0, y0, x1, y1)

Set the coordinates of the ellipse’s X-axis diameter Warning: transform matrix is not applied here

set_ydiameter(x2, y2, x3, y3)

Set the coordinates of the ellipse’s Y-axis diameter Warning: transform matrix is not applied here

show()

Show the item

testItemAttribute(attribute)

Test an item attribute

Parameters

attribute (int) – Attribute type

Returns

True/False

testItemInterest(interest)

Test an item interest

Parameters

attribute (int) – Interest type

Returns

True/False

testRenderHint(hint)

Test a render hint

Parameters

attribute (int) – Render hint

Returns

True/False

See also

setRenderHint()

title()
Returns

Title of the item

See also

setTitle()

types()

Returns a group or category for this item this should be a class object inheriting from IItemType

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()

update_item_parameters()

Update item parameters (dataset) from object properties

update_label()

Update the annotated shape’s label contents

xAxis()
Returns

xAxis

x_to_str(x)

Convert x (float) to a string (with associated unit and uncertainty)

yAxis()
Returns

yAxis

y_to_str(y)

Convert y (float) to a string (with associated unit and uncertainty)

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()