Class: QgsPlotAxis

Encapsulates the properties of a plot axis.

Warning

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

Added in version 3.26.

class qgis.core.QgsPlotAxis[source]

Bases: object

gridIntervalMajor(self) float[source]

Returns the interval of major grid lines for the axis.

Return type:

float

gridIntervalMinor(self) float[source]

Returns the interval of minor grid lines for the axis.

Return type:

float

gridMajorSymbol(self) QgsLineSymbol | None[source]

Returns the line symbol used to render the major lines in the axis grid.

Return type:

Optional[QgsLineSymbol]

gridMinorSymbol(self) QgsLineSymbol | None[source]

Returns the line symbol used to render the minor lines in the axis grid.

Return type:

Optional[QgsLineSymbol]

labelInterval(self) float[source]

Returns the interval of labels for the axis.

Return type:

float

labelSuffix(self) str[source]

Returns the axis label suffix, or an empty string if no label suffix is to be used.

See also

setLabelSuffix()

Added in version 3.32.

Return type:

str

labelSuffixPlacement(self) Qgis.PlotAxisSuffixPlacement[source]

Returns the placement for the axis label suffixes.

See also

labelSuffix()

Added in version 3.32.

Return type:

Qgis.PlotAxisSuffixPlacement

numericFormat(self) QgsNumericFormat | None[source]

Returns the numeric format used for the axis labels.

Return type:

Optional[QgsNumericFormat]

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

Reads the axis’ properties from an XML element.

Parameters:
Return type:

bool

setGridIntervalMajor(self, interval: float)[source]

Sets the interval of major grid lines for the axis.

Parameters:

interval (float)

setGridIntervalMinor(self, interval: float)[source]

Sets the interval of minor grid lines for the axis.

Parameters:

interval (float)

setGridMajorSymbol(self, symbol: QgsLineSymbol | None)[source]

Sets the symbol used to render the major lines in the axis grid.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsLineSymbol])

setGridMinorSymbol(self, symbol: QgsLineSymbol | None)[source]

Sets the symbol used to render the minor lines in the axis grid.

Ownership of symbol is transferred to the plot.

Parameters:

symbol (Optional[QgsLineSymbol])

setLabelInterval(self, interval: float)[source]

Sets the interval of labels for the axis.

See also

labelInterval()

Parameters:

interval (float)

setLabelSuffix(self, suffix: str | None)[source]

Sets the axis label suffix. Set to an empty string if no label suffix is to be used.

See also

labelSuffix()

Added in version 3.32.

Parameters:

suffix (Optional[str])

setLabelSuffixPlacement(self, placement: Qgis.PlotAxisSuffixPlacement)[source]

Sets the placement for the axis label suffixes.

See also

setLabelSuffix()

Added in version 3.32.

Parameters:

placement (Qgis.PlotAxisSuffixPlacement)

setNumericFormat(self, format: QgsNumericFormat | None)[source]

Sets the numeric format used for the axis labels.

Ownership of format is transferred to the plot.

See also

numericFormat()

Parameters:

format (Optional[QgsNumericFormat])

setTextFormat(self, format: QgsTextFormat)[source]

Sets the text format used for the axis labels.

See also

textFormat()

Parameters:

format (QgsTextFormat)

setType(self, type: Qgis.PlotAxisType)[source]

Sets the axis type.

Added in version 4.0.

Parameters:

type (Qgis.PlotAxisType)

textFormat(self) QgsTextFormat[source]

Returns the text format used for the axis labels.

See also

setTextFormat()

Return type:

QgsTextFormat

type(self) Qgis.PlotAxisType[source]

Returns the axis type.

Added in version 4.0.

Return type:

Qgis.PlotAxisType

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

Writes the axis’ properties into an XML element.

Parameters:
Return type:

bool