guiqwt.shapes

The shapes module provides geometrical shapes:

A 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.annotations

Examples

A shape may be created:
  • from the associated plot item class (e.g. RectangleShape to create a rectangle): the item properties are then assigned by creating the appropriate style parameters object (guiqwt.styles.ShapeParam)

>>> from guiqwt.shapes import RectangleShape
>>> from guiqwt.styles import ShapeParam
>>> param = ShapeParam()
>>> param.title = 'My rectangle'
>>> rect_item = RectangleShape(0., 2., 4., 0., param)
  • or using the plot item builder (see guiqwt.builder.make()):

>>> from guiqwt.builder import make
>>> rect_item = make.rectangle(0., 2., 4., 0., title='My rectangle')

Reference

class guiqwt.shapes.PolygonShape(points=None, closed=None, shapeparam=None)[source]
types()[source]

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

serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

get_points()[source]

Return polygon points

get_bounding_rect_coords()[source]

Return bounding rectangle coordinates (in plot coordinates)

hit_test(pos)[source]

return (dist, handle, inside)

move_shape(old_pos, new_pos)[source]

Translate the shape such that old_pos becomes new_pos in axis coordinates

update_item_parameters()[source]

Update item parameters (dataset) from object properties

get_item_parameters(itemparams)[source]

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

set_item_parameters(itemparams)[source]

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

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

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

hide()

Hide the item

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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)

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

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

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.RectangleShape(x1=0, y1=0, x2=0, y2=0, shapeparam=None)[source]
set_rect(x1, y1, x2, y2)[source]

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

get_center()[source]

Return center coordinates: (xc, yc)

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_item_parameters(itemparams)

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

get_points()

Return polygon points

hide()

Hide the item

hit_test(pos)

return (dist, handle, inside)

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.ObliqueRectangleShape(x0=0, y0=0, x1=0, y1=0, x2=0, y2=0, x3=0, y3=0, shapeparam=None)[source]
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 (handles used for rotation -- other handles
being used for rectangle resizing)

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

Return center coordinates: (xc, yc)

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_item_parameters(itemparams)

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

get_points()

Return polygon points

hide()

Hide the item

hit_test(pos)

return (dist, handle, inside)

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.PointShape(x=0, y=0, shapeparam=None)[source]
set_pos(x, y)[source]

Set the point coordinates to (x, y)

get_pos()[source]

Return the point coordinates

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_item_parameters(itemparams)

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

get_points()

Return polygon points

hide()

Hide the item

hit_test(pos)

return (dist, handle, inside)

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.SegmentShape(x1=0, y1=0, x2=0, y2=0, shapeparam=None)[source]
set_rect(x1, y1, x2, y2)[source]

Set the start point of this segment to (x1, y1) and the end point of this line to (x2, y2)

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_item_parameters(itemparams)

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

get_points()

Return polygon points

hide()

Hide the item

hit_test(pos)

return (dist, handle, inside)

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.EllipseShape(x1=0, y1=0, x2=0, y2=0, shapeparam=None)[source]
set_xdiameter(x0, y0, x1, y1)[source]

Set the coordinates of the ellipse’s X-axis diameter

get_xdiameter()[source]

Return the coordinates of the ellipse’s X-axis diameter

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

Set the coordinates of the ellipse’s Y-axis diameter

get_ydiameter()[source]

Return the coordinates of the ellipse’s Y-axis diameter

get_rect()[source]

Circle only!

get_center()[source]

Return center coordinates: (xc, yc)

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

Circle only!

compute_elements(xMap, yMap)[source]

Return points, lines and ellipse rect

hit_test(pos)[source]

return (dist, handle, inside)

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_item_parameters(itemparams)

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

get_points()

Return polygon points

hide()

Hide the item

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.Axes((0, 1), (1, 1), (0, 0))[source]
serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

move_shape(old_pos, new_pos)[source]

Overriden to emit the axes_changed signal

update_item_parameters()[source]

Update item parameters (dataset) from object properties

get_item_parameters(itemparams)[source]

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

set_item_parameters(itemparams)[source]

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

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

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

Return bounding rectangle coordinates (in plot coordinates)

get_points()

Return polygon points

hide()

Hide the item

hit_test(pos)

return (dist, handle, inside)

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

True if 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_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)

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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

class guiqwt.shapes.XRangeSelection(_min, _max, shapeparam=None)[source]
hit_test(pos)[source]

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

move_local_point_to(handle, pos, ctrl=None)[source]

Move a handle as returned by hit_test to the new position pos ctrl: True if <Ctrl> button is being pressed, False otherwise

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

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

hide()

Hide the item

icon()
Returns

Icon of the item

See also

setIcon()

isVisible()
Returns

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

Translate the shape such that old_pos becomes new_pos in canvas coordinates

move_shape(old_pos, new_pos)[source]

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

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

xAxis()
Returns

xAxis

yAxis()
Returns

yAxis

z()

Plot items are painted in increasing z-order.

Returns

item z order

See also

setZ(), QwtPlotDict.itemList()

update_item_parameters()[source]

Update item parameters (dataset) from object properties

get_item_parameters(itemparams)[source]

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

set_item_parameters(itemparams)[source]

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