Class: QgsPlot

Base class for plot/chart/graphs.

Warning

This class is not considered stable API, and may change in future!

Added in version 3.26.

Class Hierarchy

Inheritance diagram of qgis.core.QgsPlot

Subclasses

Qgs2DPlot

Base class for 2-dimensional plot/chart/graphs.

Enums

DataDefinedProperty

Data defined properties for different plot types

Property

alias of DataDefinedProperty

Methods

dataDefinedProperties

Returns a reference to the plot's property collection, used for data defined overrides.

propertyDefinitions

Returns the plot property definitions.

setDataDefinedProperties

Sets the plot's property collection, used for data defined overrides.

setDataDefinedProperty

Sets a data defined property for the plot.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsPlot. See the FAQ for more details.

readXml

Reads the plot's properties from an XML element.

type

Returns the plot's type.

writeXml

Writes the plot's properties into an XML element.

class qgis.core.QgsPlot[source]

Bases: object

class DataDefinedProperty(*values)

Bases: IntEnum

Data defined properties for different plot types

Added in version 4.0.

  • MarginLeft: Left margin

  • MarginTop: Top margin

  • MarginRight: Right margin

  • MarginBottom: Bottom margin

  • XAxisMajorInterval: Major grid line interval for X axis

  • XAxisMinorInterval: Minor grid line interval for X axis

  • XAxisLabelInterval: Label interval for X axis

  • YAxisMajorInterval: Major grid line interval for Y axis

  • YAxisMinorInterval: Minor grid line interval for Y axis

  • YAxisLabelInterval: Label interval for Y axis

  • XAxisMinimum: Minimum X axis value

  • XAxisMaximum: Maximum X axis value

  • YAxisMinimum: Minimum Y axis value

  • YAxisMaximum: Maximum Y axis value

Property

alias of DataDefinedProperty

dataDefinedProperties(self) QgsPropertyCollection

Returns a reference to the plot’s property collection, used for data defined overrides.

Added in version 4.0.

Return type:

QgsPropertyCollection

propertyDefinitions() Dict[int, QgsPropertyDefinition]

Returns the plot property definitions.

Return type:

Dict[int, QgsPropertyDefinition]

virtual readXml(self, element: QDomElement, context: QgsReadWriteContext) bool[source]

Reads the plot’s properties from an XML element.

Parameters:
Return type:

bool

setDataDefinedProperties(self, collection: QgsPropertyCollection)[source]

Sets the plot’s property collection, used for data defined overrides.

Parameters:

collection (QgsPropertyCollection) – property collection. Existing properties will be replaced.

Added in version 4.0.

setDataDefinedProperty(self, key: QgsPlot.DataDefinedProperty, property: QgsProperty)[source]

Sets a data defined property for the plot. Any existing property with the same key will be overwritten.

Added in version 4.0.

Parameters:
virtual type(self) str[source]

Returns the plot’s type.

Added in version 4.0.

Return type:

str

virtual writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool[source]

Writes the plot’s properties into an XML element.

Parameters:
Return type:

bool