The baseplot module provides the guiqwt plotting widget base class: guiqwt.baseplot.BasePlot. This is an enhanced version of PythonQwt‘s QwtPlot plotting widget which supports the following features:

  • add to plot, del from plot, hide/show and save/restore plot items easily
  • item selection and multiple selection
  • active item
  • plot parameters editing


guiqwt.baseplot.BasePlot is rather an internal class than a ready-to-use plotting widget. The end user should prefer using guiqwt.plot.CurvePlot or guiqwt.plot.ImagePlot.

See also

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


class guiqwt.baseplot.BasePlot(parent=None, section='plot')[source]

An enhanced QwtPlot class that provides methods for handling plotitems and axes better

It distinguishes activatable items from basic QwtPlotItems.

Activatable items must support IBasePlotItem interface and should be added to the plot using add_item methods.


Signal emitted by plot when an IBasePlotItem object was moved (args: x0, y0, x1, y1)


Signal emitted by plot when a shapes.Marker position changes


Signal emitted by plot when a shapes.Axes position (or the angle) changes


Signal emitted by plot when an annotation.AnnotatedShape position changes


Signal emitted by plot when the a shapes.XRangeSelection range changes


Signal emitted by plot when item list has changed (item removed, added, ...)


Signal emitted by plot when selected item has changed


Signal emitted by plot when an item was deleted from the item list or using the delete item tool


Signal emitted by plot when an item is selected


Signal emitted by plot when plot’s title or any axis label has changed


Signal emitted by plot when any plot axis direction has changed


Signal emitted by plot when LUT has been changed by the user


Signal emitted by plot when image mask has changed


Signal emitted by cross section plot when cross section curve data has changed

Returns:the plot’s canvas

Reimplement QWidget method


Reimplement Qwt method

set_manager(manager, plot_id)[source]

Set the associated guiqwt.plot.PlotManager instance


Preferred size


Get plot title


Set plot title


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

read_axes_styles(section, options)[source]

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


Get axis title

set_axis_title(axis_id, text)[source]

Set axis title


Get axis unit

set_axis_unit(axis_id, text)[source]

Set axis unit


Get axis font

set_axis_font(axis_id, font)[source]

Set axis font


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

set_axis_color(axis_id, color)[source]

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


Update axis style


Update all axes styles


Return axis limits (minimum and maximum values)

set_axis_limits(axis_id, vmin, vmax, stepsize=0)[source]

Set axis limits (minimum and maximum values) and optional step size

set_axis_ticks(axis_id, nmajor=None, nminor=None)[source]

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


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

set_axis_scale(axis_id, scale, autoscale=True)[source]

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


Return active curve scales

set_scales(xscale, yscale)[source]

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


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


Disable unused axes

get_items(z_sorted=False, item_type=None)[source]

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

get_public_items(z_sorted=False, item_type=None)[source]

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

get_private_items(z_sorted=False, item_type=None)[source]

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


Copy widget’s window to clipboard


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

get_selected_items(z_sorted=False, item_type=None)[source]

Return selected items


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

add_item(item, z=None)[source]

Add a plot item instance to this plot widget

item: qwt.QwtPlotItem object implementing
the IBasePlotItem interface (guiqwt.interfaces)
add_item_with_z_offset(item, zoffset)[source]

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


Remove item from widget


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

set_item_visible(item, state, notify=True, replot=True)[source]

Show/hide item and emit a SIG_ITEMS_CHANGED signal

show_items(items=None, item_type=None)[source]

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

hide_items(items=None, item_type=None)[source]

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

save_items(iofile, selected=False)[source]
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()

Restore items from file using the pickle protocol
  • iofile: file object or filename

See also guiqwt.baseplot.BasePlot.save_items()

serialize(writer, selected=False)[source]
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()

Restore items from HDF5 file:
  • reader: guidata.hdf5io.HDF5Reader object

See also guiqwt.baseplot.BasePlot.save_items_to_hdf5()


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


Remove (detach) all attached items


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


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


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


Select item


Unselect item


Return last active item corresponding to passed item_type


Select all selectable items


Unselect all selected items


Select items


Set active item, and unselect the old active item


Return active axes


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

get_nearest_object(pos, close_dist=0)[source]

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


Return the closest item

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


Return widget context menu


Return AxesParam dataset class associated to item’s type

get_plot_parameters(key, itemparams)[source]

Return a list of DataSets for a given parameter key the datasets will be edited and passed back to set_plot_parameters

this is a generic interface to help building context menus using the BasePlotMenuTool


Set item (plot, here) parameters


Edit plot parameters


Edit axis parameters

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

Do autoscale on all axes


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


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

class RenderFlags(QWidget.RenderFlags)

QWidget.RenderFlags(int) QWidget.RenderFlags()

BasePlot.acceptDrops(self) → bool
BasePlot.accessibleDescription(self) → object
BasePlot.accessibleName(self) → object
BasePlot.actionEvent(self, QActionEvent)
BasePlot.actions(self) → object
BasePlot.addAction(self, QAction)
BasePlot.addActions(self, object)
BasePlot.attachItem(plotItem, on)

Attach/Detach a plot item

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

Replots the plot if autoReplot() is True.

Returns:True if the autoReplot option is set.

See also


Parameters:axisId (int) – Axis index
Returns:True, if autoscaling is enabled
Parameters:axisId (int) – Axis index
Returns:True, if a specified axis is enabled
Parameters:axisId (int) – Axis index
Returns:The font of the scale labels for a specified axis
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()

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

See also

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

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

See also

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

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

Parameters:axisId (int) – Axis index
Returns:Specified scaleDraw for axis, or NULL if axis is invalid.
Parameters:axisId (int) – Axis index
Returns:Scale engine for a specific axis
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()

Parameters:axisId (int) – Axis index
Returns:Title of a specified axis
Parameters:axisId (int) – Axis
Returns:True if the specified axis exists, otherwise False
Parameters:axisId (int) – Axis index
Returns:Scale widget of the specified axis, or None if axisId is invalid.
BasePlot.backgroundRole(self) → QPalette.ColorRole
BasePlot.baseSize(self) → QSize
BasePlot.blockSignals(self, bool) → bool
Returns:Background brush of the plotting area.
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()

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

childAt(self, int, int) -> QWidget

BasePlot.childEvent(self, QChildEvent)
BasePlot.children(self) → object
BasePlot.childrenRect(self) → QRect
BasePlot.childrenRegion(self) → QRegion
BasePlot.close(self) → bool
BasePlot.closeEvent(self, QCloseEvent)
BasePlot.colorCount(self) → int
BasePlot.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

BasePlot.connectNotify(self, QT_SIGNAL)
BasePlot.contentsMargins(self) → QMargins
BasePlot.contentsRect(self) → QRect
BasePlot.contextMenuEvent(self, QContextMenuEvent)
BasePlot.contextMenuPolicy(self) → Qt.ContextMenuPolicy
BasePlot.create(self, window: int = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
BasePlot.cursor(self) → QCursor

customContextMenuRequested(self, QPoint) [signal]

BasePlot.customEvent(self, QEvent)
BasePlot.depth(self) → int
BasePlot.destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)

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

BasePlot.detachItems(rtti, autoDelete)

Detach items from the dictionary

  • 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
BasePlot.devType(self) → int
BasePlot.disconnect(QObject, QT_SIGNAL, QObject, QT_SLOT_QT_SIGNAL) → object

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

BasePlot.disconnectNotify(self, QT_SIGNAL)
BasePlot.dragEnterEvent(self, QDragEnterEvent)
BasePlot.dragLeaveEvent(self, QDragLeaveEvent)
BasePlot.dragMoveEvent(self, QDragMoveEvent)

Redraw the canvas.

Parameters:painter (QPainter) – Painter used for drawing


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

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

Redraw the canvas.

  • 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


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

BasePlot.dropEvent(self, QDropEvent)
BasePlot.dynamicPropertyNames(self) → object
BasePlot.effectiveWinId(self) → int
BasePlot.emit(self, QT_SIGNAL, *)
BasePlot.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.

  • axisId (int) – Axis index
  • tf (bool) – True (enabled) or False (disabled)
BasePlot.enabledChange(self, bool)
BasePlot.enterEvent(self, QEvent)
BasePlot.exportTo(filename, size=(800, 600), size_mm=None, resolution=72.0, format_=None)

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

  • 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, ...)
BasePlot.find(int) → QWidget
BasePlot.findChild(self, type, name: object = '') → object

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

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

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

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

See also


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

Calculate the canvas margins

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

BasePlot.getContentsMargins(self) → Tuple[int, int, int, int]
BasePlot.grabGesture(self, Qt.GestureType, flags: Qt.GestureFlags = Qt.GestureFlags(0))

grabMouse(self, QCursor)

BasePlot.grabShortcut(self, QKeySequence, context: Qt.ShortcutContext = Qt.WindowShortcut) → int
BasePlot.graphicsEffect(self) → QGraphicsEffect
BasePlot.graphicsProxyWidget(self) → QGraphicsProxyWidget
BasePlot.handle(self) → int
BasePlot.hasFocus(self) → bool
BasePlot.hasMouseTracking(self) → bool
BasePlot.height(self) → int
BasePlot.heightForWidth(self, int) → int
BasePlot.heightMM(self) → int
BasePlot.hideEvent(self, QHideEvent)
BasePlot.inherits(self, str) → bool

Initialize axes

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

Insert a plot item

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

See also


BasePlot.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 ).

  • 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


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


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

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

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

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


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

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

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.
BasePlot.keyPressEvent(self, QKeyEvent)
BasePlot.keyReleaseEvent(self, QKeyEvent)
BasePlot.keyboardGrabber() → QWidget
BasePlot.killTimer(self, int)
BasePlot.layout(self) → QLayout
BasePlot.layoutDirection(self) → Qt.LayoutDirection
BasePlot.leaveEvent(self, QEvent)
Returns:the plot’s legend

See also


BasePlot.lineWidth(self) → int
BasePlot.locale(self) → QLocale
BasePlot.logicalDpiX(self) → int
BasePlot.logicalDpiY(self) → int
BasePlot.mapFrom(self, QWidget, QPoint) → QPoint
BasePlot.mapFromGlobal(self, QPoint) → QPoint
BasePlot.mapFromParent(self, QPoint) → QPoint
BasePlot.mapTo(self, QWidget, QPoint) → QPoint
BasePlot.mapToGlobal(self, QPoint) → QPoint
BasePlot.mapToParent(self, QPoint) → QPoint
BasePlot.mask(self) → QRegion
BasePlot.maximumHeight(self) → int
BasePlot.maximumSize(self) → QSize
BasePlot.maximumWidth(self) → int
BasePlot.metaObject(self) → QMetaObject
BasePlot.metric(self, QPaintDevice.PaintDeviceMetric) → int
BasePlot.midLineWidth(self) → int
BasePlot.minimumHeight(self) → int
BasePlot.minimumSize(self) → QSize
Returns:Return a minimum size hint
BasePlot.minimumWidth(self) → int
BasePlot.mouseGrabber() → QWidget
BasePlot.mouseMoveEvent(self, QMouseEvent)
BasePlot.mousePressEvent(self, QMouseEvent)
BasePlot.mouseReleaseEvent(self, QMouseEvent)
BasePlot.move(self, QPoint)

move(self, int, int)

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

See also


BasePlot.pos(self) → QPoint
BasePlot.previousInFocusChain(self) → QWidget

Print plot to printer

Parameters:printer (QPaintDevice or QPrinter or QSvgGenerator) – Printer, str) → object

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.

BasePlot.receivers(self, QT_SIGNAL) → int
BasePlot.rect(self) → QRect
BasePlot.releaseShortcut(self, int)
BasePlot.removeAction(self, QAction)
BasePlot.removeEventFilter(self, QObject)

Remove a plot item

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

See also


BasePlot.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)


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


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.

BasePlot.resize(self, QSize)

resize(self, int, int)

BasePlot.restoreGeometry(self, QByteArray) → bool
BasePlot.saveGeometry(self) → QByteArray
BasePlot.scroll(self, int, int)

scroll(self, int, int, QRect)

BasePlot.sender(self) → QObject
BasePlot.senderSignalIndex(self) → int
BasePlot.setAcceptDrops(self, bool)
BasePlot.setAccessibleDescription(self, object)
BasePlot.setAccessibleName(self, object)
BasePlot.setAttribute(self, Qt.WidgetAttribute, on: bool = True)

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
BasePlot.setAutoFillBackground(self, bool)

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


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

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


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

BasePlot.setAxisFont(axisId, font)

Change the font of an axis

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


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

BasePlot.setAxisLabelAlignment(axisId, alignment)

Change the alignment of the tick labels

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

See also


BasePlot.setAxisLabelAutoSize(axisId, state)

Set tick labels automatic size option (default: on)

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

See also


BasePlot.setAxisLabelRotation(axisId, rotation)

Rotate all tick labels

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

BasePlot.setAxisMaxMajor(axisId, maxMajor)

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

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

See also


BasePlot.setAxisMaxMinor(axisId, maxMinor)

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

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

See also


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

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

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

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

Set a scale draw

  • 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


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

BasePlot.setAxisScaleEngine(axisId, scaleEngine)

Change the scale engine for an axis

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

Change the title of a specified axis

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

setBaseSize(self, QSize)


Set the drawing canvas of the plot widget.

The default canvas is a QwtPlotCanvas.

Parameters:canvas (QWidget) – Canvas Widget

See also



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
BasePlot.setContentsMargins(self, int, int, int, int)

setContentsMargins(self, QMargins)

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

setFixedSize(self, int, int)

BasePlot.setFixedWidth(self, int)

setFocus(self, Qt.FocusReason)

BasePlot.setFocusPolicy(self, Qt.FocusPolicy)
BasePlot.setFocusProxy(self, QWidget)
BasePlot.setFont(self, QFont)

Change the text the footer

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

See also


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

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

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

setMask(self, QRegion)

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

setMaximumSize(self, QSize)

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

setMinimumSize(self, QSize)

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

setParent(self, QWidget, Qt.WindowFlags)


Assign a new plot layout

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

See also


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

setSizeIncrement(self, QSize)

BasePlot.setSizePolicy(self, QSizePolicy)

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

BasePlot.setStatusTip(self, object)
BasePlot.setStyle(self, QStyle)
BasePlot.setStyleSheet(self, object)
BasePlot.setTabOrder(QWidget, QWidget)

Change the plot’s title

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

See also


BasePlot.setToolTip(self, object)
BasePlot.setUpdatesEnabled(self, bool)
BasePlot.setVisible(self, bool)
BasePlot.setWhatsThis(self, object)
BasePlot.setWindowFilePath(self, object)
BasePlot.setWindowFlags(self, Qt.WindowFlags)
BasePlot.setWindowIcon(self, QIcon)
BasePlot.setWindowIconText(self, object)
BasePlot.setWindowModality(self, Qt.WindowModality)
BasePlot.setWindowModified(self, bool)
BasePlot.setWindowOpacity(self, float)
BasePlot.setWindowRole(self, object)
BasePlot.setWindowState(self, Qt.WindowStates)
BasePlot.setWindowTitle(self, object)
BasePlot.signalsBlocked(self) → bool
BasePlot.size(self) → QSize
BasePlot.sizeIncrement(self) → QSize
BasePlot.sizePolicy(self) → QSizePolicy
BasePlot.stackUnder(self, QWidget)
BasePlot.startTimer(self, int) → int
BasePlot.statusTip(self) → object → QStyle
BasePlot.styleSheet(self) → object
BasePlot.tabletEvent(self, QTabletEvent)
BasePlot.testAttribute(self, Qt.WidgetAttribute) → bool
BasePlot.thread(self) → QThread
BasePlot.timerEvent(self, QTimerEvent)
Returns:Title of the plot

See also


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

Transform a value into a coordinate in the plotting region

  • axisId (int) – Axis index
  • value (fload) – Value

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

BasePlot.underMouse(self) → bool
BasePlot.ungrabGesture(self, Qt.GestureType)

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


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


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


Adjust plot content to its current size.

See also



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

BasePlot.updateLegendItems(plotItem, legendData)

Update all plot items interested in legend attributes

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

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

See also

QwtPlotItem.LegendInterest(), QwtPlotItem.updateLegend()

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