Class: Qgs2DXyPlot

Base class for 2-dimensional plot/chart/graphs with an X and Y axes.

The base class is responsible for rendering the axis, grid lines and chart area. Subclasses can implement the renderContent() method to render their actual plot content.

Warning

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

Added in version 3.26.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.Qgs2DXyPlot

Base classes

Qgs2DPlot

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

QgsPlot

Base class for plot/chart/graphs.

Subclasses

QgsBarChartPlot

A simple bar chart class.

QgsLineChartPlot

A simple line chart class.

Methods

applyDataDefinedProperties

Applies 2D XY plot data-defined properties

calculateOptimisedIntervals

Automatically sets the grid and label intervals to optimal values for display in the given render context.

chartBackgroundSymbol

Returns the fill symbol used to render the background of the chart.

chartBorderSymbol

Returns the symbol used to render the border of the chart.

copyCommonProperties

Copies all Qgs2DXyPlot-level properties (axis ranges, axes, flip state, background and border symbols) from other to this plot.

flipAxes

Returns whether the X and Y axes are flipped.

setChartBackgroundSymbol

Sets the fill symbol used to render the background of the chart.

setChartBorderSymbol

Sets the symbol used to render the border of the chart.

setFlipAxes

Sets whether the X and Y axes are flipped.

setXMaximum

Sets the maximum value of the x axis.

setXMinimum

Sets the minimum value of the x axis.

setYMaximum

Sets the maximum value of the y axis.

setYMinimum

Sets the minimum value of the y axis.

xAxis

Returns a reference to the plot's x axis.

xMaximum

Returns the maximum value of the x axis.

xMinimum

Returns the minimum value of the x axis.

yAxis

Returns a reference to the plot's y axis.

yMaximum

Returns the maximum value of the y axis.

yMinimum

Returns the minimum value of the y axis.

Virtual Methods

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

interiorPlotArea

Returns the area of the plot which corresponds to the actual plot content (excluding all titles and other components which sit outside the plot area).

class qgis.core.Qgs2DXyPlot[source]

Bases: Qgs2DPlot

__init__()

Constructor for Qgs2DXyPlot.

applyDataDefinedProperties(self, context: QgsRenderContext)[source]

Applies 2D XY plot data-defined properties

Parameters:

context (QgsRenderContext)

Return type:

(float, float, float, float, float, float, float, float, float, float)

calculateOptimisedIntervals(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext)[source]

Automatically sets the grid and label intervals to optimal values for display in the given render context.

Intervals will be calculated in order to avoid overlapping axis labels and to ensure round values are shown.

Parameters:
chartBackgroundSymbol(self) QgsFillSymbol | None[source]

Returns the fill symbol used to render the background of the chart.

Return type:

Optional[QgsFillSymbol]

chartBorderSymbol(self) QgsFillSymbol | None[source]

Returns the symbol used to render the border of the chart.

Return type:

Optional[QgsFillSymbol]

copyCommonProperties(self, other: Qgs2DXyPlot | None)[source]

Copies all Qgs2DXyPlot-level properties (axis ranges, axes, flip state, background and border symbols) from other to this plot.

Added in version 4.0.

Parameters:

other (Optional[Qgs2DXyPlot])

flipAxes(self) bool[source]

Returns whether the X and Y axes are flipped.

Return type:

bool

virtual interiorPlotArea(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext, plotData: QgsPlotData = QgsPlotData()) QRectF[source]

Returns the area of the plot which corresponds to the actual plot content (excluding all titles and other components which sit outside the plot area).

Parameters:
Return type:

QRectF

setChartBackgroundSymbol(self, symbol: QgsFillSymbol | None)[source]

Sets the fill symbol used to render the background of the chart.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsFillSymbol])

setChartBorderSymbol(self, symbol: QgsFillSymbol | None)[source]

Sets the symbol used to render the border of the chart.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsFillSymbol])

setFlipAxes(self, flipAxes: bool)[source]

Sets whether the X and Y axes are flipped.

Parameters:

flipAxes (bool)

setXMaximum(self, maximum: float)[source]

Sets the maximum value of the x axis.

See also

xMaximum()

Parameters:

maximum (float)

setXMinimum(self, minimum: float)[source]

Sets the minimum value of the x axis.

See also

xMinimum()

Parameters:

minimum (float)

setYMaximum(self, maximum: float)[source]

Sets the maximum value of the y axis.

See also

yMaximum()

Parameters:

maximum (float)

setYMinimum(self, minimum: float)[source]

Sets the minimum value of the y axis.

See also

yMinimum()

Parameters:

minimum (float)

xAxis(self) QgsPlotAxis

Returns a reference to the plot’s x axis.

See also

yAxis()

Return type:

QgsPlotAxis

xMaximum(self) float[source]

Returns the maximum value of the x axis.

See also

setXMaximum()

Return type:

float

xMinimum(self) float[source]

Returns the minimum value of the x axis.

See also

setXMinimum()

Return type:

float

yAxis(self) QgsPlotAxis

Returns a reference to the plot’s y axis.

See also

xAxis()

Return type:

QgsPlotAxis

yMaximum(self) float[source]

Returns the maximum value of the y axis.

See also

setYMaximum()

Return type:

float

yMinimum(self) float[source]

Returns the minimum value of the y axis.

See also

setYMinimum()

Return type:

float