guiqwt.image

The image module provides image-related objects and functions:

ImageItem, TrImageItem, XYImageItem, Histogram2DItem and ImageFilterItem objects are plot items (derived from QwtPlotItem) that may be displayed on a guiqwt.image.ImagePlot plotting widget.

See also

Module guiqwt.curve
Module providing curve-related plot items and plotting widgets
Module guiqwt.plot
Module providing ready-to-use curve and image plotting widgets and dialog boxes

Examples

Create a basic image plotting widget:

  • before creating any widget, a QApplication must be instantiated (that is a Qt internal requirement):
>>> import guidata
>>> app = guidata.qapplication()
  • that is mostly equivalent to the following (the only difference is that the guidata helper function also installs the Qt translation corresponding to the system locale):
>>> from PyQt4.QtGui import QApplication
>>> app = QApplication([])
  • now that a QApplication object exists, we may create the plotting widget:
>>> from guiqwt.image import ImagePlot
>>> plot = ImagePlot(title="Example")

Generate random data for testing purpose:

>>> import numpy as np
>>> data = np.random.rand(100, 100)

Create a simple image item:

  • from the associated plot item class (e.g. XYImageItem to create an image with non-linear X/Y axes): the item properties are then assigned by creating the appropriate style parameters object (e.g. guiqwt.styles.ImageParam)
>>> from guiqwt.curve import ImageItem
>>> from guiqwt.styles import ImageParam
>>> param = ImageParam()
>>> param.label = 'My image'
>>> image = ImageItem(param)
>>> image.set_data(data)
  • or using the plot item builder (see guiqwt.builder.make()):
>>> from guiqwt.builder import make
>>> image = make.image(data, title='My image')

Attach the image to the plotting widget:

>>> plot.add_item(image)

Display the plotting widget:

>>> plot.show()
>>> app.exec_()

Reference

class guiqwt.image.ImagePlot(parent=None, title=None, xlabel=None, ylabel=None, zlabel=None, xunit=None, yunit=None, zunit=None, yreverse=True, aspect_ratio=1.0, lock_aspect_ratio=True, gridparam=None, section='plot')[source]

Construct a 2D curve and image plotting widget (this class inherits guiqwt.curve.CurvePlot)

  • parent: parent widget
  • title: plot title (string)
  • xlabel, ylabel, zlabel: resp. bottom, left and right axis titles (strings)
  • xunit, yunit, zunit: resp. bottom, left and right axis units (strings)
  • yreverse: reversing y-axis direction of increasing values (bool)
  • aspect_ratio: height to width ratio (float)
  • lock_aspect_ratio: locking aspect ratio (bool)
DEFAULT_ITEM_TYPE

alias of IImageItemType

showEvent(event)[source]

Override BasePlot method

do_zoom_view(dx, dy)[source]

Reimplement CurvePlot method

do_zoom_rect_view(start, end)[source]

Reimplement CurvePlot method

update_lut_range(_min, _max)[source]

update the LUT scale

get_current_aspect_ratio()[source]

Return current aspect ratio

get_aspect_ratio()[source]

Return aspect ratio

set_aspect_ratio(ratio=None, lock=None)[source]

Set aspect ratio

notify_colormap_changed()[source]

Levels histogram range has changed

resizeEvent(event)[source]

Reimplement Qt method to resize widget

class RenderFlags(QWidget.RenderFlags)

QWidget.RenderFlags(int) QWidget.RenderFlags()

ImagePlot.acceptDrops(self) → bool
ImagePlot.accessibleDescription(self) → object
ImagePlot.accessibleName(self) → object
ImagePlot.actionEvent(self, QActionEvent)
ImagePlot.actions(self) → object
ImagePlot.activateWindow(self)
ImagePlot.addAction(self, QAction)
ImagePlot.addActions(self, object)
ImagePlot.add_item(item, z=None, autoscale=True)[source]

Add a plot item instance to this plot widget

  • item: qwt.QwtPlotItem object implementing the guiqwt.interfaces.IBasePlotItem interface
  • z: item’s z order (None -> z = max(self.get_items())+1) autoscale: True -> rescale plot to fit image bounds
ImagePlot.add_item_with_z_offset(item, zoffset)

Add a plot item instance within a specified z range, over zmin

ImagePlot.adjustSize(self)
ImagePlot.attachItem(plotItem, on)

Attach/Detach a plot item

Parameters:
  • plotItem (qwt.plot.QwtPlotItem) – Plot item
  • on (bool) – When true attach the item, otherwise detach it
ImagePlot.autoDelete()
Returns:true if auto deletion is enabled
ImagePlot.autoFillBackground(self) → bool
ImagePlot.autoRefresh()

Replots the plot if autoReplot() is True.

ImagePlot.autoReplot()
Returns:True if the autoReplot option is set.

See also

setAutoReplot()

ImagePlot.axisAutoScale(axisId)
Parameters:axisId (int) – Axis index
Returns:True, if autoscaling is enabled
ImagePlot.axisEnabled(axisId)
Parameters:axisId (int) – Axis index
Returns:True, if a specified axis is enabled
ImagePlot.axisFont(axisId)
Parameters:axisId (int) – Axis index
Returns:The font of the scale labels for a specified axis
ImagePlot.axisInterval(axisId)
Parameters:axisId (int) – Axis index
Returns:The current interval of the specified axis

This is only a convenience function for axisScaleDiv(axisId).interval()

See also

qwt.scale_div.QwtScaleDiv, axisScaleDiv()

ImagePlot.axisMaxMajor(axisId)
Parameters:axisId (int) – Axis index
Returns:The maximum number of major ticks for a specified axis

See also

setAxisMaxMajor(), qwt.scale_engine.QwtScaleEngine.divideScale()

ImagePlot.axisMaxMinor(axisId)
Parameters:axisId (int) – Axis index
Returns:The maximum number of minor ticks for a specified axis

See also

setAxisMaxMinor(), qwt.scale_engine.QwtScaleEngine.divideScale()

ImagePlot.axisScaleDiv(axisId)
Parameters:axisId (int) – Axis index
Returns:The scale division of a specified axis

axisScaleDiv(axisId).lowerBound(), axisScaleDiv(axisId).upperBound() are the current limits of the axis scale.

See also

qwt.scale_div.QwtScaleDiv, setAxisScaleDiv(), qwt.scale_engine.QwtScaleEngine.divideScale()

ImagePlot.axisScaleDraw(axisId)
Parameters:axisId (int) – Axis index
Returns:Specified scaleDraw for axis, or NULL if axis is invalid.
ImagePlot.axisScaleEngine(axisId)
Parameters:axisId (int) – Axis index
Returns:Scale engine for a specific axis
ImagePlot.axisStepSize(axisId)
Parameters:axisId (int) – Axis index
Returns:step size parameter value

This doesn’t need to be the step size of the current scale.

See also

setAxisScale(), qwt.scale_engine.QwtScaleEngine.divideScale()

ImagePlot.axisTitle(axisId)
Parameters:axisId (int) – Axis index
Returns:Title of a specified axis
ImagePlot.axisValid(axisId)
Parameters:axisId (int) – Axis
Returns:True if the specified axis exists, otherwise False
ImagePlot.axisWidget(axisId)
Parameters:axisId (int) – Axis index
Returns:Scale widget of the specified axis, or None if axisId is invalid.
ImagePlot.backgroundRole(self) → QPalette.ColorRole
ImagePlot.baseSize(self) → QSize
ImagePlot.blockSignals(self, bool) → bool
ImagePlot.canvas()
Returns:the plot’s canvas
ImagePlot.canvasBackground()
Returns:Background brush of the plotting area.
ImagePlot.canvasMap(axisId)
Parameters:axisId (int) – Axis
Returns:Map for the axis on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa.

See also

qwt.scale_map.QwtScaleMap, transform(), invTransform()

ImagePlot.changeEvent(self, QEvent)
ImagePlot.childAt(self, QPoint) → QWidget

childAt(self, int, int) -> QWidget

ImagePlot.childEvent(self, QChildEvent)
ImagePlot.children(self) → object
ImagePlot.childrenRect(self) → QRect
ImagePlot.childrenRegion(self) → QRegion
ImagePlot.clearFocus(self)
ImagePlot.clearMask(self)
ImagePlot.close(self) → bool
ImagePlot.closeEvent(self, QCloseEvent)
ImagePlot.colorCount(self) → int
ImagePlot.connect(QObject, QT_SIGNAL, QObject, QT_SLOT_QT_SIGNAL, Qt.ConnectionType = Qt.AutoConnection) → object

connect(QObject, QT_SIGNAL, Callable[..., None], Qt.ConnectionType = Qt.AutoConnection) -> object connect(self, QObject, QT_SIGNAL, QT_SLOT_QT_SIGNAL, Qt.ConnectionType = Qt.AutoConnection) -> object

ImagePlot.connectNotify(self, QT_SIGNAL)
ImagePlot.contentsMargins(self) → QMargins
ImagePlot.contentsRect(self) → QRect
ImagePlot.contextMenuEvent(self, QContextMenuEvent)
ImagePlot.contextMenuPolicy(self) → Qt.ContextMenuPolicy
ImagePlot.copy_to_clipboard()

Copy widget’s window to clipboard

ImagePlot.create(self, window: int = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
ImagePlot.cursor(self) → QCursor
ImagePlot.customContextMenuRequested

customContextMenuRequested(self, QPoint) [signal]

ImagePlot.customEvent(self, QEvent)
ImagePlot.del_all_items(except_grid=True)

Del all items, eventually (default) except grid

ImagePlot.del_item(item)

Remove item from widget Convenience function (see ‘del_items’)

ImagePlot.del_items(items)

Remove item from widget

ImagePlot.deleteLater(self)
ImagePlot.depth(self) → int
ImagePlot.deserialize(reader)
Restore items from HDF5 file:
  • reader: guidata.hdf5io.HDF5Reader object

See also guiqwt.baseplot.BasePlot.save_items_to_hdf5()

ImagePlot.destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
ImagePlot.destroyed

destroyed(self, QObject = None) [signal] destroyed(self) [signal]

ImagePlot.detachItems(rtti, autoDelete)

Detach items from the dictionary

Parameters:
  • rtti (int) – In case of QwtPlotItem.Rtti_PlotItem detach all items otherwise only those items of the type rtti.
  • autoDelete (bool) – If true, delete all detached items
ImagePlot.devType(self) → int
ImagePlot.disable_autoscale()

Re-apply the axis scales so as to disable autoscaling without changing the view

ImagePlot.disconnect(QObject, QT_SIGNAL, QObject, QT_SLOT_QT_SIGNAL) → object

disconnect(QObject, QT_SIGNAL, Callable[..., None]) -> object

ImagePlot.disconnectNotify(self, QT_SIGNAL)
ImagePlot.do_pan_view(dx, dy)

Translate the active axes by dx, dy dx, dy are tuples composed of (initial pos, dest pos)

ImagePlot.dragEnterEvent(self, QDragEnterEvent)
ImagePlot.dragLeaveEvent(self, QDragLeaveEvent)
ImagePlot.dragMoveEvent(self, QDragMoveEvent)
ImagePlot.drawCanvas(painter)

Redraw the canvas.

Parameters:painter (QPainter) – Painter used for drawing

Warning

drawCanvas calls drawItems what is also used for printing. Applications that like to add individual plot items better overload drawItems()

See also

getCanvasMarginsHint(), QwtPlotItem.getCanvasMarginHint()

ImagePlot.drawFrame(self, QPainter)
ImagePlot.drawItems(painter, canvasRect, maps)

Redraw the canvas.

Parameters:
  • painter (QPainter) – Painter used for drawing
  • canvasRect (QRectF) – Bounding rectangle where to paint
  • maps (list) – QwtPlot.axisCnt maps, mapping between plot and paint device coordinates

Note

Usually canvasRect is contentsRect() of the plot canvas. Due to a bug in Qt this rectangle might be wrong for certain frame styles ( f.e QFrame.Box ) and it might be necessary to fix the margins manually using QWidget.setContentsMargins()

ImagePlot.dropEvent(self, QDropEvent)
ImagePlot.dumpObjectInfo(self)
ImagePlot.dumpObjectTree(self)
ImagePlot.dynamicPropertyNames(self) → object
ImagePlot.edit_plot_parameters(key)

Edit plot parameters

ImagePlot.effectiveWinId(self) → int
ImagePlot.emit(self, QT_SIGNAL, *)
ImagePlot.enableAxis(axisId, tf=True)

Enable or disable a specified axis

When an axis is disabled, this only means that it is not visible on the screen. Curves, markers and can be attached to disabled axes, and transformation of screen coordinates into values works as normal.

Only xBottom and yLeft are enabled by default.

Parameters:
  • axisId (int) – Axis index
  • tf (bool) – True (enabled) or False (disabled)
ImagePlot.enable_used_axes()

Enable only used axes For now, this is needed only by the pyplot interface

ImagePlot.enabledChange(self, bool)
ImagePlot.ensurePolished(self)
ImagePlot.enterEvent(self, QEvent)
ImagePlot.exportTo(filename, size=(800, 600), size_mm=None, resolution=72.0, format_=None)

Export plot to PDF or image file (SVG, PNG, ...)

Parameters:
  • filename (str) – Filename
  • size (tuple) – (width, height) size in pixels
  • size_mm (tuple) – (width, height) size in millimeters
  • resolution (float) – Image resolution
  • format (str) – File format (PDF, SVG, PNG, ...)
ImagePlot.find(int) → QWidget
ImagePlot.findChild(self, type, name: object = '') → object

findChild(self, Tuple, name: object = ‘’) -> object

ImagePlot.findChildren(self, type, name: object = '') → List

findChildren(self, Tuple, name: object = ‘’) -> List findChildren(self, type, QRegExp) -> List findChildren(self, Tuple, QRegExp) -> List

ImagePlot.focusInEvent(self, QFocusEvent)
ImagePlot.focusNextChild(self) → bool
ImagePlot.focusNextPrevChild(self, bool) → bool
ImagePlot.focusOutEvent(self, QFocusEvent)
ImagePlot.focusPolicy(self) → Qt.FocusPolicy
ImagePlot.focusPreviousChild(self) → bool
ImagePlot.focusProxy(self) → QWidget
ImagePlot.focusWidget(self) → QWidget
ImagePlot.font(self) → QFont
ImagePlot.fontChange(self, QFont)
ImagePlot.fontInfo(self) → QFontInfo
ImagePlot.fontMetrics(self) → QFontMetrics
ImagePlot.footer()
Returns:Text of the footer

See also

setFooter()

ImagePlot.footerLabel()
Returns:Footer label widget.
ImagePlot.foregroundRole(self) → QPalette.ColorRole
ImagePlot.frameGeometry(self) → QRect
ImagePlot.frameRect(self) → QRect
ImagePlot.frameShadow(self) → QFrame.Shadow
ImagePlot.frameShape(self) → QFrame.Shape
ImagePlot.frameSize(self) → QSize
ImagePlot.frameStyle(self) → int
ImagePlot.frameWidth(self) → int
ImagePlot.geometry(self) → QRect
ImagePlot.getCanvasMarginsHint(maps, canvasRect)

Calculate the canvas margins

Parameters:
  • maps (list) – QwtPlot.axisCnt maps, mapping between plot and paint device coordinates
  • canvasRect (QRectF) – Bounding rectangle where to paint

Plot items might indicate, that they need some extra space at the borders of the canvas by the QwtPlotItem.Margins flag.

See also

updateCanvasMargins(), getCanvasMarginHint()

ImagePlot.getContentsMargins(self) → Tuple[int, int, int, int]
ImagePlot.get_active_axes()

Return active axes

ImagePlot.get_active_item(force=False)

Return active item Force item activation if there is no active item

ImagePlot.get_axis_color(axis_id)

Get axis color (color name, i.e. string)

ImagePlot.get_axis_direction(axis_id)

Return axis direction of increasing values

  • axis_id: axis id (BasePlot.Y_LEFT, BasePlot.X_BOTTOM, ...) or string: ‘bottom’, ‘left’, ‘top’ or ‘right’
ImagePlot.get_axis_font(axis_id)

Get axis font

ImagePlot.get_axis_id(axis_name)

Return axis ID from axis name If axis ID is passed directly, check the ID

ImagePlot.get_axis_limits(axis_id)

Return axis limits (minimum and maximum values)

ImagePlot.get_axis_scale(axis_id)

Return the name (‘lin’ or ‘log’) of the scale used by axis

ImagePlot.get_axis_title(axis_id)

Get axis title

ImagePlot.get_axis_unit(axis_id)

Get axis unit

ImagePlot.get_context_menu()

Return widget context menu

ImagePlot.get_default_item()

Return default item, depending on plot’s default item type (e.g. for a curve plot, this is a curve item type).

Return nothing if there is more than one item matching the default item type.

ImagePlot.get_items(z_sorted=False, item_type=None)

Return widget’s item list (items are based on IBasePlotItem’s interface)

ImagePlot.get_last_active_item(item_type)

Return last active item corresponding to passed item_type

ImagePlot.get_max_z()

Return maximum z-order for all items registered in plot If there is no item, return 0

ImagePlot.get_nearest_object(pos, close_dist=0)

Return nearest item from position ‘pos’

If close_dist > 0:

Return the first found item (higher z) which distance to ‘pos’ is less than close_dist

else:

Return the closest item
ImagePlot.get_nearest_object_in_z(pos)

Return nearest item for which position ‘pos’ is inside of it (iterate over items with respect to their ‘z’ coordinate)

ImagePlot.get_plot_limits(xaxis='bottom', yaxis='left')

Return plot scale limits

ImagePlot.get_private_items(z_sorted=False, item_type=None)

Return widget’s private item list (items are based on IBasePlotItem’s interface)

ImagePlot.get_public_items(z_sorted=False, item_type=None)

Return widget’s public item list (items are based on IBasePlotItem’s interface)

ImagePlot.get_scales()

Return active curve scales

ImagePlot.get_selected_items(z_sorted=False, item_type=None)

Return selected items

ImagePlot.get_title()

Get plot title

ImagePlot.grabGesture(self, Qt.GestureType, flags: Qt.GestureFlags = Qt.GestureFlags(0))
ImagePlot.grabKeyboard(self)
ImagePlot.grabMouse(self)

grabMouse(self, QCursor)

ImagePlot.grabShortcut(self, QKeySequence, context: Qt.ShortcutContext = Qt.WindowShortcut) → int
ImagePlot.graphicsEffect(self) → QGraphicsEffect
ImagePlot.graphicsProxyWidget(self) → QGraphicsProxyWidget
ImagePlot.handle(self) → int
ImagePlot.hasFocus(self) → bool
ImagePlot.hasMouseTracking(self) → bool
ImagePlot.height(self) → int
ImagePlot.heightForWidth(self, int) → int
ImagePlot.heightMM(self) → int
ImagePlot.hide(self)
ImagePlot.hideEvent(self, QHideEvent)
ImagePlot.hide_items(items=None, item_type=None)

Hide items (if items is None, hide all items)

ImagePlot.inherits(self, str) → bool
ImagePlot.initAxesData()

Initialize axes

ImagePlot.inputContext(self) → QInputContext
ImagePlot.inputMethodEvent(self, QInputMethodEvent)
ImagePlot.inputMethodHints(self) → Qt.InputMethodHints
ImagePlot.inputMethodQuery(self, Qt.InputMethodQuery) → object
ImagePlot.insertAction(self, QAction, QAction)
ImagePlot.insertActions(self, QAction, object)
ImagePlot.insertItem(item)

Insert a plot item

Parameters:item (qwt.plot.QwtPlotItem) – PlotItem

See also

removeItem()

ImagePlot.insertLegend(legend, pos=None, ratio=-1)

Insert a legend

If the position legend is QwtPlot.LeftLegend or QwtPlot.RightLegend the legend will be organized in one column from top to down. Otherwise the legend items will be placed in a table with a best fit number of columns from left to right.

insertLegend() will set the plot widget as parent for the legend. The legend will be deleted in the destructor of the plot or when another legend is inserted.

Legends, that are not inserted into the layout of the plot widget need to connect to the legendDataChanged() signal. Calling updateLegend() initiates this signal for an initial update. When the application code wants to implement its own layout this also needs to be done for rendering plots to a document ( see QwtPlotRenderer ).

Parameters:
  • legend (qwt.legend.QwtAbstractLegend) – Legend
  • pos (QwtPlot.LegendPosition) – The legend’s position.
  • ratio (float) – Ratio between legend and the bounding rectangle of title, canvas and axes

Note

For top/left position the number of columns will be limited to 1, otherwise it will be set to unlimited.

Note

The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.

See also

legend(), qwt.plot_layout.QwtPlotLayout.legendPosition(), qwt.plot_layout.QwtPlotLayout.setLegendPosition()

ImagePlot.installEventFilter(self, QObject)
ImagePlot.invTransform(axisId, pos)

Transform the x or y coordinate of a position in the drawing region into a value.

Parameters:
  • axisId (int) – Axis index
  • pos (int) – position

Warning

The position can be an x or a y coordinate, depending on the specified axis.

ImagePlot.invalidate()

Invalidate paint cache and schedule redraw use instead of replot when only the content of the canvas needs redrawing (axes, shouldn’t change)

ImagePlot.isActiveWindow(self) → bool
ImagePlot.isAncestorOf(self, QWidget) → bool
ImagePlot.isEnabled(self) → bool
ImagePlot.isEnabledTo(self, QWidget) → bool
ImagePlot.isEnabledToTLW(self) → bool
ImagePlot.isFullScreen(self) → bool
ImagePlot.isHidden(self) → bool
ImagePlot.isLeftToRight(self) → bool
ImagePlot.isMaximized(self) → bool
ImagePlot.isMinimized(self) → bool
ImagePlot.isModal(self) → bool
ImagePlot.isRightToLeft(self) → bool
ImagePlot.isTopLevel(self) → bool
ImagePlot.isVisible(self) → bool
ImagePlot.isVisibleTo(self, QWidget) → bool
ImagePlot.isWidgetType(self) → bool
ImagePlot.isWindow(self) → bool
ImagePlot.isWindowModified(self) → bool
ImagePlot.itemList(rtti=None)

A list of attached plot items.

Use caution when iterating these lists, as removing/detaching an item will invalidate the iterator. Instead you can place pointers to objects to be removed in a removal list, and traverse that list later.

Parameters:rtti (int) – In case of QwtPlotItem.Rtti_PlotItem detach all items otherwise only those items of the type rtti.
Returns:List of all attached plot items of a specific type. If rtti is None, return a list of all attached plot items.
ImagePlot.keyPressEvent(self, QKeyEvent)
ImagePlot.keyReleaseEvent(self, QKeyEvent)
ImagePlot.keyboardGrabber() → QWidget
ImagePlot.killTimer(self, int)
ImagePlot.languageChange(self)
ImagePlot.layout(self) → QLayout
ImagePlot.layoutDirection(self) → Qt.LayoutDirection
ImagePlot.leaveEvent(self, QEvent)
ImagePlot.legend()
Returns:the plot’s legend

See also

insertLegend()

ImagePlot.lineWidth(self) → int
ImagePlot.locale(self) → QLocale
ImagePlot.logicalDpiX(self) → int
ImagePlot.logicalDpiY(self) → int
ImagePlot.lower(self)
ImagePlot.mapFrom(self, QWidget, QPoint) → QPoint
ImagePlot.mapFromGlobal(self, QPoint) → QPoint
ImagePlot.mapFromParent(self, QPoint) → QPoint
ImagePlot.mapTo(self, QWidget, QPoint) → QPoint
ImagePlot.mapToGlobal(self, QPoint) → QPoint
ImagePlot.mapToParent(self, QPoint) → QPoint
ImagePlot.mask(self) → QRegion
ImagePlot.maximumHeight(self) → int
ImagePlot.maximumSize(self) → QSize
ImagePlot.maximumWidth(self) → int
ImagePlot.metaObject(self) → QMetaObject
ImagePlot.metric(self, QPaintDevice.PaintDeviceMetric) → int
ImagePlot.midLineWidth(self) → int
ImagePlot.minimumHeight(self) → int
ImagePlot.minimumSize(self) → QSize
ImagePlot.minimumSizeHint()
Returns:Return a minimum size hint
ImagePlot.minimumWidth(self) → int
ImagePlot.mouseDoubleClickEvent(event)

Reimplement QWidget method

ImagePlot.mouseGrabber() → QWidget
ImagePlot.mouseMoveEvent(self, QMouseEvent)
ImagePlot.mousePressEvent(self, QMouseEvent)
ImagePlot.mouseReleaseEvent(self, QMouseEvent)
ImagePlot.move(self, QPoint)

move(self, int, int)

ImagePlot.moveEvent(self, QMoveEvent)
ImagePlot.moveToThread(self, QThread)
ImagePlot.move_down(item_list)

Move item(s) down, i.e. to the background (swap item with the previous item in z-order)

item: plot item or list of plot items

Return True if items have been moved effectively

ImagePlot.move_up(item_list)

Move item(s) up, i.e. to the foreground (swap item with the next item in z-order)

item: plot item or list of plot items

Return True if items have been moved effectively

ImagePlot.nativeParentWidget(self) → QWidget
ImagePlot.nextInFocusChain(self) → QWidget
ImagePlot.normalGeometry(self) → QRect
ImagePlot.numColors(self) → int
ImagePlot.objectName(self) → object
ImagePlot.overrideWindowFlags(self, Qt.WindowFlags)
ImagePlot.overrideWindowState(self, Qt.WindowStates)
ImagePlot.paintEngine(self) → QPaintEngine
ImagePlot.paintEvent(self, QPaintEvent)
ImagePlot.paintingActive(self) → bool
ImagePlot.palette(self) → QPalette
ImagePlot.paletteChange(self, QPalette)
ImagePlot.parent(self) → QObject
ImagePlot.parentWidget(self) → QWidget
ImagePlot.physicalDpiX(self) → int
ImagePlot.physicalDpiY(self) → int
ImagePlot.plotLayout()
Returns:the plot’s layout

See also

setPlotLayout()

ImagePlot.pos(self) → QPoint
ImagePlot.previousInFocusChain(self) → QWidget
ImagePlot.print_(printer)

Print plot to printer

Parameters:printer (QPaintDevice or QPrinter or QSvgGenerator) – Printer
ImagePlot.property(self, str) → object
ImagePlot.pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

ImagePlot.raise_(self)
ImagePlot.read_axes_styles(section, options)

Read axes styles from section and options (one option for each axis in the order left, right, bottom, top)

Skip axis if option is None

ImagePlot.receivers(self, QT_SIGNAL) → int
ImagePlot.rect(self) → QRect
ImagePlot.releaseKeyboard(self)
ImagePlot.releaseMouse(self)
ImagePlot.releaseShortcut(self, int)
ImagePlot.removeAction(self, QAction)
ImagePlot.removeEventFilter(self, QObject)
ImagePlot.removeItem(item)

Remove a plot item

Parameters:item (qwt.plot.QwtPlotItem) – PlotItem

See also

insertItem()

ImagePlot.render(self, QPaintDevice, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags = QWidget.DrawWindowBackground|QWidget.DrawChildren)

render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: QWidget.RenderFlags = QWidget.DrawWindowBackground|QWidget.DrawChildren)

ImagePlot.repaint(self)

repaint(self, int, int, int, int) repaint(self, QRect) repaint(self, QRegion)

ImagePlot.replot()

Redraw the plot

If the autoReplot option is not set (which is the default) or if any curves are attached to raw data, the plot has to be refreshed explicitly in order to make changes visible.

ImagePlot.resetInputContext(self)
ImagePlot.resize(self, QSize)

resize(self, int, int)

ImagePlot.restoreGeometry(self, QByteArray) → bool
ImagePlot.restore_items(iofile)
Restore items from file using the pickle protocol
  • iofile: file object or filename

See also guiqwt.baseplot.BasePlot.save_items()

ImagePlot.saveGeometry(self) → QByteArray
ImagePlot.save_items(iofile, selected=False)
Save (serializable) items to file using the pickle protocol
  • iofile: file object or filename
  • selected=False: if True, will save only selected items

See also guiqwt.baseplot.BasePlot.restore_items()

ImagePlot.save_widget(fname)

Grab widget’s window and save it to filename (*.png, *.pdf)

ImagePlot.scroll(self, int, int)

scroll(self, int, int, QRect)

ImagePlot.select_all()

Select all selectable items

ImagePlot.select_item(item)

Select item

ImagePlot.select_some_items(items)

Select items

ImagePlot.sender(self) → QObject
ImagePlot.senderSignalIndex(self) → int
ImagePlot.serialize(writer, selected=False)
Save (serializable) items to HDF5 file:
  • writer: guidata.hdf5io.HDF5Writer object
  • selected=False: if True, will save only selected items

See also guiqwt.baseplot.BasePlot.restore_items_from_hdf5()

ImagePlot.setAcceptDrops(self, bool)
ImagePlot.setAccessibleDescription(self, object)
ImagePlot.setAccessibleName(self, object)
ImagePlot.setAttribute(self, Qt.WidgetAttribute, on: bool = True)
ImagePlot.setAutoDelete(autoDelete)

En/Disable Auto deletion

If Auto deletion is on all attached plot items will be deleted in the destructor of QwtPlotDict. The default value is on.

Parameters:autoDelete (bool) – enable/disable
ImagePlot.setAutoFillBackground(self, bool)
ImagePlot.setAutoReplot(tf=True)

Set or reset the autoReplot option

If the autoReplot option is set, the plot will be updated implicitly by manipulating member functions. Since this may be time-consuming, it is recommended to leave this option switched off and call replot() explicitly if necessary.

The autoReplot option is set to false by default, which means that the user has to call replot() in order to make changes visible.

Parameters:tf (bool) – True or False. Defaults to True.

See also

canvas()

ImagePlot.setAxisAutoScale(axisId, on=True)

Enable autoscaling for a specified axis

This member function is used to switch back to autoscaling mode after a fixed scale has been set. Autoscaling is enabled by default.

Parameters:
  • axisId (int) – Axis index
  • on (bool) – On/Off

Note

The autoscaling flag has no effect until updateAxes() is executed ( called by replot() ).

ImagePlot.setAxisFont(axisId, font)

Change the font of an axis

Parameters:
  • axisId (int) – Axis index
  • font (QFont) – Font

Warning

This function changes the font of the tick labels, not of the axis title.

ImagePlot.setAxisLabelAlignment(axisId, alignment)

Change the alignment of the tick labels

Parameters:
  • axisId (int) – Axis index
  • alignment (Qt.Alignment) – Or’d Qt.AlignmentFlags

See also

qwt.scale_draw.QwtScaleDraw.setLabelAlignment()

ImagePlot.setAxisLabelAutoSize(axisId, state)

Set tick labels automatic size option (default: on)

Parameters:
  • axisId (int) – Axis index
  • state (bool) – On/off

See also

qwt.scale_draw.QwtScaleDraw.setLabelAutoSize()

ImagePlot.setAxisLabelRotation(axisId, rotation)

Rotate all tick labels

Parameters:
  • axisId (int) – Axis index
  • rotation (float) – Angle in degrees. When changing the label rotation, the label alignment might be adjusted too.

See also

setLabelRotation(), setAxisLabelAlignment()

ImagePlot.setAxisMaxMajor(axisId, maxMajor)

Set the maximum number of major scale intervals for a specified axis

Parameters:
  • axisId (int) – Axis index
  • maxMajor (int) – Maximum number of major steps

See also

axisMaxMajor()

ImagePlot.setAxisMaxMinor(axisId, maxMinor)

Set the maximum number of minor scale intervals for a specified axis

Parameters:
  • axisId (int) – Axis index
  • maxMinor (int) – Maximum number of minor steps

See also

axisMaxMinor()

ImagePlot.setAxisScale(axisId, min_, max_, stepSize=0)

Disable autoscaling and specify a fixed scale for a selected axis.

In updateAxes() the scale engine calculates a scale division from the specified parameters, that will be assigned to the scale widget. So updates of the scale widget usually happen delayed with the next replot.

Parameters:
  • axisId (int) – Axis index
  • min (float) – Minimum of the scale
  • max (float) – Maximum of the scale
  • stepSize (float) – Major step size. If <code>step == 0</code>, the step size is calculated automatically using the maxMajor setting.

See also

setAxisMaxMajor(), setAxisAutoScale(), axisStepSize(), qwt.scale_engine.QwtScaleEngine.divideScale()

ImagePlot.setAxisScaleDiv(axisId, scaleDiv)

Disable autoscaling and specify a fixed scale for a selected axis.

The scale division will be stored locally only until the next call of updateAxes(). So updates of the scale widget usually happen delayed with the next replot.

Parameters:
  • axisId (int) – Axis index
  • scaleDiv (qwt.scale_div.QwtScaleDiv) – Scale division
ImagePlot.setAxisScaleDraw(axisId, scaleDraw)

Set a scale draw

Parameters:
  • axisId (int) – Axis index
  • scaleDraw (qwt.scale_draw.QwtScaleDraw) – Object responsible for drawing scales.

By passing scaleDraw it is possible to extend QwtScaleDraw functionality and let it take place in QwtPlot. Please note that scaleDraw has to be created with new and will be deleted by the corresponding QwtScale member ( like a child object ).

See also

qwt.scale_draw.QwtScaleDraw, qwt.scale_widget.QwtScaleWigdet

Warning

The attributes of scaleDraw will be overwritten by those of the previous QwtScaleDraw.

ImagePlot.setAxisScaleEngine(axisId, scaleEngine)

Change the scale engine for an axis

Parameters:
  • axisId (int) – Axis index
  • scaleEngine (qwt.scale_engine.QwtScaleEngine) – Scale engine
ImagePlot.setAxisTitle(axisId, title)

Change the title of a specified axis

Parameters:
  • axisId (int) – Axis index
  • title (qwt.text.QwtText or str) – axis title
ImagePlot.setBackgroundRole(self, QPalette.ColorRole)
ImagePlot.setBaseSize(self, int, int)

setBaseSize(self, QSize)

ImagePlot.setCanvas(canvas)

Set the drawing canvas of the plot widget.

The default canvas is a QwtPlotCanvas.

Parameters:canvas (QWidget) – Canvas Widget

See also

canvas()

ImagePlot.setCanvasBackground(brush)

Change the background of the plotting area

Sets brush to QPalette.Window of all color groups of the palette of the canvas. Using canvas().setPalette() is a more powerful way to set these colors.

Parameters:brush (QBrush) – New background brush
ImagePlot.setContentsMargins(self, int, int, int, int)

setContentsMargins(self, QMargins)

ImagePlot.setContextMenuPolicy(self, Qt.ContextMenuPolicy)
ImagePlot.setCursor(self, QCursor)
ImagePlot.setDisabled(self, bool)
ImagePlot.setEnabled(self, bool)
ImagePlot.setFixedHeight(self, int)
ImagePlot.setFixedSize(self, QSize)

setFixedSize(self, int, int)

ImagePlot.setFixedWidth(self, int)
ImagePlot.setFocus(self)

setFocus(self, Qt.FocusReason)

ImagePlot.setFocusPolicy(self, Qt.FocusPolicy)
ImagePlot.setFocusProxy(self, QWidget)
ImagePlot.setFont(self, QFont)
ImagePlot.setFooter(text)

Change the text the footer

Parameters:text (str or qwt.text.QwtText) – New text of the footer

See also

footer()

ImagePlot.setForegroundRole(self, QPalette.ColorRole)
ImagePlot.setFrameRect(self, QRect)
ImagePlot.setFrameShadow(self, QFrame.Shadow)
ImagePlot.setFrameShape(self, QFrame.Shape)
ImagePlot.setFrameStyle(self, int)
ImagePlot.setGeometry(self, QRect)

setGeometry(self, int, int, int, int)

ImagePlot.setGraphicsEffect(self, QGraphicsEffect)
ImagePlot.setHidden(self, bool)
ImagePlot.setInputContext(self, QInputContext)
ImagePlot.setInputMethodHints(self, Qt.InputMethodHints)
ImagePlot.setLayout(self, QLayout)
ImagePlot.setLayoutDirection(self, Qt.LayoutDirection)
ImagePlot.setLineWidth(self, int)
ImagePlot.setLocale(self, QLocale)
ImagePlot.setMask(self, QBitmap)

setMask(self, QRegion)

ImagePlot.setMaximumHeight(self, int)
ImagePlot.setMaximumSize(self, int, int)

setMaximumSize(self, QSize)

ImagePlot.setMaximumWidth(self, int)
ImagePlot.setMidLineWidth(self, int)
ImagePlot.setMinimumHeight(self, int)
ImagePlot.setMinimumSize(self, int, int)

setMinimumSize(self, QSize)

ImagePlot.setMinimumWidth(self, int)
ImagePlot.setMouseTracking(self, bool)
ImagePlot.setObjectName(self, object)
ImagePlot.setPalette(self, QPalette)
ImagePlot.setParent(self, QWidget)

setParent(self, QWidget, Qt.WindowFlags)

ImagePlot.setPlotLayout(layout)

Assign a new plot layout

Parameters:layout (qwt.plot_layout.QwtPlotLayout) – Layout

See also

plotLayout()

ImagePlot.setProperty(self, str, object) → bool
ImagePlot.setShortcutAutoRepeat(self, int, enabled: bool = True)
ImagePlot.setShortcutEnabled(self, int, enabled: bool = True)
ImagePlot.setShown(self, bool)
ImagePlot.setSizeIncrement(self, int, int)

setSizeIncrement(self, QSize)

ImagePlot.setSizePolicy(self, QSizePolicy)

setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)

ImagePlot.setStatusTip(self, object)
ImagePlot.setStyle(self, QStyle)
ImagePlot.setStyleSheet(self, object)
ImagePlot.setTabOrder(QWidget, QWidget)
ImagePlot.setTitle(title)

Change the plot’s title

Parameters:title (str or qwt.text.QwtText) – New title

See also

title()

ImagePlot.setToolTip(self, object)
ImagePlot.setUpdatesEnabled(self, bool)
ImagePlot.setVisible(self, bool)
ImagePlot.setWhatsThis(self, object)
ImagePlot.setWindowFilePath(self, object)
ImagePlot.setWindowFlags(self, Qt.WindowFlags)
ImagePlot.setWindowIcon(self, QIcon)
ImagePlot.setWindowIconText(self, object)
ImagePlot.setWindowModality(self, Qt.WindowModality)
ImagePlot.setWindowModified(self, bool)
ImagePlot.setWindowOpacity(self, float)
ImagePlot.setWindowRole(self, object)
ImagePlot.setWindowState(self, Qt.WindowStates)
ImagePlot.setWindowTitle(self, object)
ImagePlot.set_antialiasing(checked)

Toggle curve antialiasing

ImagePlot.set_axis_color(axis_id, color)

Set axis color color: color name (string) or QColor instance

ImagePlot.set_axis_direction(axis_id, reverse=False)

Set axis direction of increasing values

  • axis_id: axis id (BasePlot.Y_LEFT, BasePlot.X_BOTTOM, ...) or string: ‘bottom’, ‘left’, ‘top’ or ‘right’

  • reverse: False (default)
    • x-axis values increase from left to right
    • y-axis values increase from bottom to top
  • reverse: True
    • x-axis values increase from right to left
    • y-axis values increase from top to bottom
ImagePlot.set_axis_font(axis_id, font)

Set axis font

ImagePlot.set_axis_limits(axis_id, vmin, vmax, stepsize=0)

Set axis limits (minimum and maximum values)

ImagePlot.set_axis_scale(axis_id, scale, autoscale=True)

Set axis scale Example: self.set_axis_scale(curve.yAxis(), ‘lin’)

ImagePlot.set_axis_ticks(axis_id, nmajor=None, nminor=None)

Set axis maximum number of major ticks and maximum of minor ticks

ImagePlot.set_axis_title(axis_id, text)

Set axis title

ImagePlot.set_axis_unit(axis_id, text)

Set axis unit

ImagePlot.set_item_visible(item, state, notify=True, replot=True)

Show/hide item and emit a SIG_ITEMS_CHANGED signal

ImagePlot.set_items(*args)

Utility function used to quickly setup a plot with a set of items

ImagePlot.set_items_readonly(state)

Set all items readonly state to state Default item’s readonly state: False (items may be deleted)

ImagePlot.set_manager(manager, plot_id)

Set the associated guiqwt.plot.PlotManager instance

ImagePlot.set_plot_limits(x0, x1, y0, y1, xaxis='bottom', yaxis='left')

Set plot scale limits

ImagePlot.set_pointer(pointer_type)

Set pointer.

Valid values of pointer_type:

  • None: disable pointer
  • “canvas”: enable canvas pointer
  • “curve”: enable on-curve pointer
ImagePlot.set_scales(xscale, yscale)

Set active curve scales Example: self.set_scales(‘lin’, ‘lin’)

ImagePlot.set_title(title)

Set plot title

ImagePlot.set_titles(title=None, xlabel=None, ylabel=None, xunit=None, yunit=None)

Set plot and axes titles at once

  • title: plot title
  • xlabel: (bottom axis title, top axis title) or bottom axis title only
  • ylabel: (left axis title, right axis title) or left axis title only
  • xunit: (bottom axis unit, top axis unit) or bottom axis unit only
  • yunit: (left axis unit, right axis unit) or left axis unit only
ImagePlot.show(self)
ImagePlot.showFullScreen(self)
ImagePlot.showMaximized(self)
ImagePlot.showMinimized(self)
ImagePlot.showNormal(self)
ImagePlot.show_items(items=None, item_type=None)

Show items (if items is None, show all items)

ImagePlot.signalsBlocked(self) → bool
ImagePlot.size(self) → QSize
ImagePlot.sizeHint()

Preferred size

ImagePlot.sizeIncrement(self) → QSize
ImagePlot.sizePolicy(self) → QSizePolicy
ImagePlot.stackUnder(self, QWidget)
ImagePlot.startTimer(self, int) → int
ImagePlot.statusTip(self) → object
ImagePlot.style(self) → QStyle
ImagePlot.styleSheet(self) → object
ImagePlot.tabletEvent(self, QTabletEvent)
ImagePlot.testAttribute(self, Qt.WidgetAttribute) → bool
ImagePlot.thread(self) → QThread
ImagePlot.timerEvent(self, QTimerEvent)
ImagePlot.title()
Returns:Title of the plot

See also

setTitle()

ImagePlot.titleLabel()
Returns:Title label widget.
ImagePlot.toolTip(self) → object
ImagePlot.topLevelWidget(self) → QWidget
ImagePlot.tr(self, object, disambiguation: str = None, n: int = -1) → object
ImagePlot.trUtf8(self, object, disambiguation: str = None, n: int = -1) → object
ImagePlot.transform(axisId, value)

Transform a value into a coordinate in the plotting region

Parameters:
  • axisId (int) – Axis index
  • value (fload) – Value
Returns:

X or Y coordinate in the plotting region corresponding to the value.

ImagePlot.underMouse(self) → bool
ImagePlot.ungrabGesture(self, Qt.GestureType)
ImagePlot.unselect_all()

Unselect all selected items

ImagePlot.unselect_item(item)

Unselect item

ImagePlot.unsetCursor(self)
ImagePlot.unsetLayoutDirection(self)
ImagePlot.unsetLocale(self)
ImagePlot.update(self)

update(self, QRect) update(self, QRegion) update(self, int, int, int, int)

ImagePlot.updateAxes()

Rebuild the axes scales

In case of autoscaling the boundaries of a scale are calculated from the bounding rectangles of all plot items, having the QwtPlotItem.AutoScale flag enabled (QwtScaleEngine.autoScale()). Then a scale division is calculated (QwtScaleEngine.didvideScale()) and assigned to scale widget.

When the scale boundaries have been assigned with setAxisScale() a scale division is calculated (QwtScaleEngine.didvideScale()) for this interval and assigned to the scale widget.

When the scale has been set explicitly by setAxisScaleDiv() the locally stored scale division gets assigned to the scale widget.

The scale widget indicates modifications by emitting a QwtScaleWidget.scaleDivChanged() signal.

updateAxes() is usually called by replot().

See also

setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot(), QwtPlotItem.boundingRect()

ImagePlot.updateCanvasMargins()

Update the canvas margins

Plot items might indicate, that they need some extra space at the borders of the canvas by the QwtPlotItem.Margins flag.

See also

getCanvasMarginsHint(), QwtPlotItem.getCanvasMarginHint()

ImagePlot.updateGeometry(self)
ImagePlot.updateLayout()

Adjust plot content to its current size.

See also

resizeEvent()

ImagePlot.updateLegend(plotItem=None)

If plotItem is None, emit QwtPlot.legendDataChanged for all plot item. Otherwise, emit the signal for passed plot item.

Parameters:plotItem (qwt.plot.QwtPlotItem) – Plot item

See also

QwtPlotItem.legendData(), QwtPlot.legendDataChanged

ImagePlot.updateLegendItems(plotItem, legendData)

Update all plot items interested in legend attributes

Call QwtPlotItem.updateLegend(), when the QwtPlotItem.LegendInterest flag is set.

Parameters:
  • plotItem (qwt.plot.QwtPlotItem) – Plot item
  • legendData (list) – Entries to be displayed for the plot item ( usually 1 )

See also

QwtPlotItem.LegendInterest(), QwtPlotItem.updateLegend()

ImagePlot.updateMicroFocus(self)
ImagePlot.update_all_axes_styles()

Update all axes styles

ImagePlot.update_axis_style(axis_id)

Update axis style

ImagePlot.updatesEnabled(self) → bool
ImagePlot.visibleRegion(self) → QRegion
ImagePlot.whatsThis(self) → object
ImagePlot.wheelEvent(self, QWheelEvent)
ImagePlot.width(self) → int
ImagePlot.widthMM(self) → int
ImagePlot.winId(self) → int
ImagePlot.window(self) → QWidget
ImagePlot.windowActivationChange(self, bool)
ImagePlot.windowFilePath(self) → object
ImagePlot.windowFlags(self) → Qt.WindowFlags
ImagePlot.windowIcon(self) → QIcon
ImagePlot.windowIconText(self) → object
ImagePlot.windowModality(self) → Qt.WindowModality
ImagePlot.windowOpacity(self) → float
ImagePlot.windowRole(self) → object
ImagePlot.windowState(self) → Qt.WindowStates
ImagePlot.windowTitle(self) → object
ImagePlot.windowType(self) → Qt.WindowType
ImagePlot.x(self) → int
ImagePlot.x11Info(self) → QX11Info
ImagePlot.x11PictureHandle(self) → int
ImagePlot.y(self) → int
ImagePlot.set_active_item(item)[source]

Override base set_active_item to change the grid’s axes according to the selected item

ImagePlot.disable_unused_axes()[source]

Disable unused axes

ImagePlot.do_autoscale(replot=True, axis_id=None)[source]

Do autoscale on all axes

ImagePlot.get_axesparam_class(item)[source]

Return AxesParam dataset class associated to item’s type

ImagePlot.edit_axis_parameters(axis_id)[source]

Edit axis parameters

class guiqwt.image.BaseImageItem(data=None, param=None)[source]
get_default_param()[source]

Return instance of the default imageparam DataSet

get_filter(filterobj, filterparam)[source]

Provides a filter object over this image’s content

get_pixel_coordinates(xplot, yplot)[source]

Return (image) pixel coordinates Transform the plot coordinates (arbitrary plot Z-axis unit) into the image coordinates (pixel unit)

Rounding is necessary to obtain array indexes from these coordinates

get_plot_coordinates(xpixel, ypixel)[source]

Return plot coordinates Transform the image coordinates (pixel unit) into the plot coordinates (arbitrary plot Z-axis unit)

get_closest_indexes(x, y, corner=None)[source]

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

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

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

align_rectangular_shape(shape)[source]

Align rectangular shape to image pixels

get_closest_pixel_indexes(x, y)[source]

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)[source]

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_closest_coordinates(x, y)[source]

Return closest image pixel coordinates

set_interpolation(interp_mode, size=None)[source]

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

get_interpolation()[source]

Get interpolation mode

set_lut_range(lut_range)[source]

Set LUT transform range lut_range is a tuple: (min, max)

get_lut_range()[source]

Return the LUT transform range tuple: (min, max)

get_lut_range_full()[source]

Return full dynamic range

get_lut_range_max()[source]

Get maximum range for this dataset

update_border()[source]

Update image border rectangle to fit image shape

draw_border(painter, xMap, yMap, canvasRect)[source]

Draw image border rectangle

draw_image(painter, canvasRect, src_rect, dst_rect, xMap, yMap)[source]

Draw image with painter on canvasRect

Warning

src_rect and dst_rect are coordinates tuples (xleft, ytop, xright, ybottom)

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)[source]

Export Region Of Interest to array

set_readonly(state)[source]

Set object readonly state

is_readonly()[source]

Return object readonly state

set_private(state)[source]

Set object as private

is_private()[source]

Return True if object is private

select()[source]

Select item

unselect()[source]

Unselect item

is_empty()[source]

Return True if item data is empty

set_selectable(state)[source]

Set item selectable state

set_resizable(state)[source]

Set item resizable state (or any action triggered when moving an handle, e.g. rotation)

set_movable(state)[source]

Set item movable state

set_rotatable(state)[source]

Set item rotatable state

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

move_local_shape(old_pos, new_pos)[source]

Translate the shape such that old_pos becomes new_pos in canvas coordinates

move_with_selection(delta_x, delta_y)[source]

Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates

get_histogram(nbins)[source]

interface de IHistDataSource

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

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)[source]

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)[source]

Return cross section along y-axis at x=x0

get_average_xsection(x0, y0, x1, y1, apply_lut=False)[source]

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)[source]

Return average cross section along y-axis

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

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

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

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

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

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

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

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

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.image.RawImageItem(data=None, param=None)[source]

Construct a simple image item

  • data: 2D NumPy array
  • param (optional): image parameters (guiqwt.styles.RawImageParam instance)
get_default_param()[source]

Return instance of the default imageparam DataSet

serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

load_data(lut_range=None)[source]

Load data from filename and eventually apply specified lut_range filename has been set using method ‘set_filename’

set_data(data, lut_range=None)[source]

Set Image item data

  • data: 2D NumPy array
  • lut_range: LUT range – tuple (levelmin, levelmax)
align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

draw_image(painter, canvasRect, src_rect, dst_rect, xMap, yMap)

Draw image with painter on canvasRect

Warning

src_rect and dst_rect are coordinates tuples (xleft, ytop, xright, ybottom)

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates Transform the plot coordinates (arbitrary plot Z-axis unit) into the image coordinates (pixel unit)

Rounding is necessary to obtain array indexes from these coordinates

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates Transform the image coordinates (pixel unit) into the plot coordinates (arbitrary plot Z-axis unit)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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

update_border()

Update image border rectangle to fit image shape

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.image.ImageItem(data=None, param=None)[source]

Construct a simple image item

get_default_param()[source]

Return instance of the default imageparam DataSet

serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

get_xdata()[source]

Return (xmin, xmax)

get_ydata()[source]

Return (ymin, ymax)

get_pixel_coordinates(xplot, yplot)[source]

Return (image) pixel coordinates (from plot coordinates)

get_plot_coordinates(xpixel, ypixel)[source]

Return plot coordinates (from image pixel coordinates)

get_closest_coordinates(x, y)[source]

Return closest image pixel coordinates

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)[source]

Export Region Of Interest to array

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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
load_data(lut_range=None)

Load data from filename and eventually apply specified lut_range filename has been set using method ‘set_filename’

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

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

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_data(data, lut_range=None)

Set Image item data

  • data: 2D NumPy array
  • lut_range: LUT range – tuple (levelmin, levelmax)
set_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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

update_border()

Update image border rectangle to fit image shape

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.image.TrImageItem(data=None, param=None)[source]

Construct a transformable image item

get_default_param()[source]

Return instance of the default imageparam DataSet

get_crop_coordinates()[source]

Return crop rectangle coordinates

get_filter(filterobj, filterparam)[source]

Provides a filter object over this image’s content

get_pixel_coordinates(xplot, yplot)[source]

Return (image) pixel coordinates (from plot coordinates)

get_plot_coordinates(xpixel, ypixel)[source]

Return plot coordinates (from image pixel coordinates)

get_closest_coordinates(x, y)[source]

Return closest image pixel coordinates

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)[source]

Export Region Of Interest to array

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

move_local_shape(old_pos, new_pos)[source]

Translate the shape such that old_pos becomes new_pos in canvas coordinates

move_with_selection(delta_x, delta_y)[source]

Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

deserialize(reader)

Deserialize object from HDF5 reader

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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
load_data(lut_range=None)

Load data from filename and eventually apply specified lut_range filename has been set using method ‘set_filename’

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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.image.XYImageItem(x=None, y=None, data=None, param=None)[source]

Construct an image item with non-linear X/Y axes

  • x: 1D NumPy array, must be increasing
  • y: 1D NumPy array, must be increasing
  • data: 2D NumPy array
  • param (optional): image parameters (guiqwt.styles.XYImageParam instance)
get_default_param()[source]

Return instance of the default imageparam DataSet

serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

get_filter(filterobj, filterparam)[source]

Provides a filter object over this image’s content

get_pixel_coordinates(xplot, yplot)[source]

Return (image) pixel coordinates (from plot coordinates)

get_plot_coordinates(xpixel, ypixel)[source]

Return plot coordinates (from image pixel coordinates)

get_closest_coordinates(x, y)[source]

Return closest image pixel coordinates

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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
load_data(lut_range=None)

Load data from filename and eventually apply specified lut_range filename has been set using method ‘set_filename’

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

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

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_data(data, lut_range=None)

Set Image item data

  • data: 2D NumPy array
  • lut_range: LUT range – tuple (levelmin, levelmax)
set_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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

update_border()

Update image border rectangle to fit image shape

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.image.RGBImageItem(data=None, param=None)[source]

Construct a RGB/RGBA image item

  • data: NumPy array of uint8 (shape: NxMx[34] – 3: RGB, 4: RGBA) (last dimension: 0: Red, 1: Green, 2: Blue {, 3:Alpha})
  • param (optional): image parameters (guiqwt.styles.RGBImageParam instance)
get_default_param()[source]

Return instance of the default imageparam DataSet

load_data()[source]

Load data from filename filename has been set using method ‘set_filename’

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

deserialize(reader)

Deserialize object from HDF5 reader

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates (from plot coordinates)

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates (from image pixel coordinates)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xdata()

Return (xmin, xmax)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ydata()

Return (ymin, ymax)

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

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

update_border()

Update image border rectangle to fit image shape

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.image.MaskedImageItem(data=None, mask=None, param=None)[source]

Construct a masked image item

  • data: 2D NumPy array
  • mask (optional): 2D NumPy array
  • param (optional): image parameters (guiqwt.styles.MaskedImageParam instance)
get_default_param()[source]

Return instance of the default imageparam DataSet

serialize(writer)[source]

Serialize object to HDF5 writer

deserialize(reader)[source]

Deserialize object from HDF5 reader

set_mask(mask)[source]

Set image mask

get_mask()[source]

Return image mask

set_mask_filename(fname)[source]

Set mask filename

There are two ways for pickling mask data of MaskedImageItem objects:

  1. using the mask filename (as for data itself)
  2. using the mask areas (MaskedAreas instance, see set_mask_areas)

When saving objects, the first method is tried and then, if no filename has been defined for mask data, the second method is used.

set_masked_areas(areas)[source]

Set masked areas (see set_mask_filename)

apply_masked_areas()[source]

Apply masked areas

mask_all()[source]

Mask all pixels

unmask_all()[source]

Unmask all pixels

mask_rectangular_area(x0, y0, x1, y1, inside=True, trace=True, do_signal=True)[source]

Mask rectangular area If inside is True (default), mask the inside of the area Otherwise, mask the outside

mask_circular_area(x0, y0, x1, y1, inside=True, trace=True, do_signal=True)[source]

Mask circular area, inside the rectangle (x0, y0, x1, y1), i.e. circle with a radius of .5\*(x1-x0) If inside is True (default), mask the inside of the area Otherwise, mask the outside

is_mask_visible()[source]

Return mask visibility

set_mask_visible(state)[source]

Set mask visibility

set_data(data, lut_range=None)[source]

Set Image item data

  • data: 2D NumPy array
  • lut_range: LUT range – tuple (levelmin, levelmax)
align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates (from plot coordinates)

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates (from image pixel coordinates)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xdata()

Return (xmin, xmax)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ydata()

Return (ymin, ymax)

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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
load_data(lut_range=None)

Load data from filename and eventually apply specified lut_range filename has been set using method ‘set_filename’

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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

update_border()

Update image border rectangle to fit image shape

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.image.ImageFilterItem(image, filter, param)[source]

Construct a rectangular area image filter item

set_image(image)[source]

Set the image item on which the filter will be applied

set_filter(filter)[source]

Set the filter function

  • filter: function (x, y, data) –> data
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

move_local_shape(old_pos, new_pos)[source]

Translate the shape such that old_pos becomes new_pos in canvas coordinates

move_with_selection(delta_x, delta_y)[source]

Translate the shape together with other selected items delta_x, delta_y: translation in plot coordinates

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

draw_image(painter, canvasRect, src_rect, dst_rect, xMap, yMap)

Draw image with painter on canvasRect

Warning

src_rect and dst_rect are coordinates tuples (xleft, ytop, xright, ybottom)

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_default_param()

Return instance of the default imageparam DataSet

get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates Transform the plot coordinates (arbitrary plot Z-axis unit) into the image coordinates (pixel unit)

Rounding is necessary to obtain array indexes from these coordinates

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates Transform the image coordinates (pixel unit) into the plot coordinates (arbitrary plot Z-axis unit)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

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

update_border()

Update image border rectangle to fit image shape

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.image.XYImageFilterItem(image, filter, param)[source]

Construct a rectangular area image filter item

set_image(image)[source]

Set the image item on which the filter will be applied

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_default_param()

Return instance of the default imageparam DataSet

get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_histogram(nbins)

interface de IHistDataSource

get_interpolation()

Get interpolation mode

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates Transform the plot coordinates (arbitrary plot Z-axis unit) into the image coordinates (pixel unit)

Rounding is necessary to obtain array indexes from these coordinates

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates Transform the image coordinates (pixel unit) into the plot coordinates (arbitrary plot Z-axis unit)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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

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

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

Set the filter function

  • filter: function (x, y, data) –> data
set_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

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

update_border()

Update image border rectangle to fit image shape

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.image.Histogram2DItem(X, Y, param=None, Z=None)[source]

Construct a 2D histogram item

set_bins(NX, NY)[source]

Set histogram bins

set_data(X, Y, Z=None)[source]

Set histogram data

get_histogram(nbins)[source]

interface de IHistDataSource

align_rectangular_shape(shape)

Align rectangular shape to image pixels

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

defaultIcon(brush, size)

Return a default icon from a brush

The default icon is a filled rectangle used in several derived classes as legendIcon().

Parameters:
  • brush (QBrush) – Fill brush
  • size (QSizeF) – Icon size
Returns:

A filled rectangle

detach()

Detach the item from a plot.

This method detaches a QwtPlotItem from any QwtPlot it has been associated with.

See also

attach()

draw_border(painter, xMap, yMap, canvasRect)

Draw image border rectangle

export_roi(src_rect, dst_rect, dst_image, apply_lut=False, apply_interpolation=False, original_resolution=False)

Export Region Of Interest to array

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_average_xsection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along x-axis

get_average_ysection(x0, y0, x1, y1, apply_lut=False)

Return average cross section along y-axis

get_closest_coordinates(x, y)

Return closest image pixel coordinates

get_closest_index_rect(x0, y0, x1, y1)

Return closest image rectangular pixel area index bounds Avoid returning empty rectangular area (return 1x1 pixel area instead) Handle reversed/not-reversed Y-axis orientation

get_closest_indexes(x, y, corner=None)

Return closest image pixel indexes corner: None (not a corner), ‘TL’ (top-left corner), ‘BR’ (bottom-right corner)

get_closest_pixel_indexes(x, y)

Return closest pixel indexes Instead of returning indexes of an image pixel like the method ‘get_closest_indexes’, this method returns the indexes of the closest pixel which is not necessarily on the image itself (i.e. indexes may be outside image index bounds: negative or superior than the image dimension)

Note

This is not the same as retrieving the canvas pixel coordinates (which depends on the zoom level)

get_data(x0, y0, x1=None, y1=None)

Return image data Arguments: x0, y0 [, x1, y1] Return image level at coordinates (x0,y0)

If x1,y1 are specified:

Return image levels (np.ndarray) in rectangular area (x0,y0,x1,y1)
get_default_param()

Return instance of the default imageparam DataSet

get_filter(filterobj, filterparam)

Provides a filter object over this image’s content

get_interpolation()

Get interpolation mode

get_lut_range()

Return the LUT transform range tuple: (min, max)

get_lut_range_full()

Return full dynamic range

get_lut_range_max()

Get maximum range for this dataset

get_pixel_coordinates(xplot, yplot)

Return (image) pixel coordinates Transform the plot coordinates (arbitrary plot Z-axis unit) into the image coordinates (pixel unit)

Rounding is necessary to obtain array indexes from these coordinates

get_plot_coordinates(xpixel, ypixel)

Return plot coordinates Transform the image coordinates (pixel unit) into the plot coordinates (arbitrary plot Z-axis unit)

get_stats(x0, y0, x1, y1)

Return formatted string with stats on image rectangular area (output should be compatible with AnnotatedShape.get_infos)

get_xsection(y0, apply_lut=False)

Return cross section along x-axis at y=y0

get_ysection(x0, apply_lut=False)

Return cross section along y-axis at x=x0

hide()

Hide the item

isVisible()
Returns:True if visible

See also

setVisible(), show(), hide()

is_empty()

Return True if item data is empty

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

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

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_interpolation(interp_mode, size=None)

Set image interpolation mode

interp_mode: INTERP_NEAREST, INTERP_LINEAR, INTERP_AA size (integer): (for anti-aliasing only) AA matrix size

set_lut_range(lut_range)

Set LUT transform range lut_range is a tuple: (min, max)

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

update_border()

Update image border rectangle to fit image shape

xAxis()
Returns:xAxis
yAxis()
Returns:yAxis
z()

Plot items are painted in increasing z-order.

Returns:item z order

See also

setZ(), QwtPlotDict.itemList()

guiqwt.image.assemble_imageitems(items, src_qrect, destw, desth, align=None, add_images=False, apply_lut=False, apply_interpolation=False, original_resolution=False)[source]

Assemble together image items in qrect (QRectF object) and return resulting pixel data

Warning

Does not support XYImageItem objects

guiqwt.image.get_plot_qrect(plot, p0, p1)[source]

Return QRectF rectangle object in plot coordinates from top-left and bottom-right QPointF objects in canvas coordinates

guiqwt.image.get_image_from_plot(plot, p0, p1, destw=None, desth=None, add_images=False, apply_lut=False, apply_interpolation=False, original_resolution=False)[source]

Return pixel data of a rectangular plot area (image items only) p0, p1: resp. top-left and bottom-right points (QPointF objects) apply_lut: apply contrast settings add_images: add superimposed images (instead of replace by the foreground)

Warning

Support only the image items implementing the IExportROIImageItemType interface, i.e. this does not support XYImageItem objects