Class: QgsPlotWidget

Base class for widgets which allow control over the properties of plots.

Added in version 4.0.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: createPlot(), setPlot()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsPlotWidget

Base classes

QgsPanelWidget

Base class for any widget that can be shown as an inline panel.

QWidget

QObject

QPaintDevice

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

Subclasses

QgsBarChartPlotWidget

Widget class to control the properties of bar chart plots.

QgsLineChartPlotWidget

Widget class to control the properties of line chart plots.

QgsPieChartPlotWidget

Widget class to control the properties of pie chart plots.

Abstract Methods

createPlot

Creates a plot defined by the current settings in the widget.

setPlot

Sets the widget to match the settings of the plot.

Methods

initializeDataDefinedButton

Initiate a data-defined property button tied to a plot widget.

registerExpressionContextGenerator

Register an expression context generator class that will be used to retrieve an expression context for configuration widgets when required.

updateDataDefinedButton

Initiate a data-defined property button tied to a plot widget.

class qgis.gui.QgsPlotWidget[source]

Bases: QgsPanelWidget, QgsExpressionContextGenerator

__init__(parent: QWidget | None = None)

Constructor for QgsPlotWidget.

Parameters:

parent (Optional[QWidget] = None) – parent widget

abstract createPlot(self) QgsPlot | None[source]

Creates a plot defined by the current settings in the widget.

See also

setPlot()

Return type:

Optional[QgsPlot]

initializeDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsPlot.DataDefinedProperty)[source]

Initiate a data-defined property button tied to a plot widget.

Parameters:
registerExpressionContextGenerator(self, generator: QgsExpressionContextGenerator | None)[source]

Register an expression context generator class that will be used to retrieve an expression context for configuration widgets when required.

Parameters:

generator (Optional[QgsExpressionContextGenerator])

abstract setPlot(self, plot: QgsPlot | None)[source]

Sets the widget to match the settings of the plot. Ownership is not transferred.

See also

createPlot()

Parameters:

plot (Optional[QgsPlot])

updateDataDefinedButton(self, button: QgsPropertyOverrideButton | None)[source]

Initiate a data-defined property button tied to a plot widget.

Parameters:

button (Optional[QgsPropertyOverrideButton])