Class: Qgs2DPlot¶
Base class for 2-dimensional plot/chart/graphs.
Warning
This class is not considered stable API, and may change in future!
Added in version 3.26.
Class Hierarchy¶
Base classes¶
Base class for plot/chart/graphs. |
Subclasses¶
Base class for 2-dimensional plot/chart/graphs with an X and Y axes. |
Methods
Returns the margins of the plot area (in millimeters) |
|
Sets the margins of the plot area (in millimeters) |
|
Sets the overall size of the plot (including titles and over components which sit outside the plot area). |
|
Returns the overall size of the plot (in millimeters) (including titles and other components which sit outside the plot area). |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of Qgs2DPlot. See the FAQ for more details.
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). |
|
Renders the plot. |
|
Renders the plot content. |
- class qgis.core.Qgs2DPlot[source]¶
Bases:
QgsPlot
- __init__()
Constructor for Qgs2DPlot.
- virtual interiorPlotArea(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext) 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:
context (QgsRenderContext)
plotContext (QgsPlotRenderContext)
- Return type:
QRectF
- margins(self) QgsMargins ¶
Returns the margins of the plot area (in millimeters)
See also
- Return type:
- virtual render(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext, plotData: QgsPlotData = QgsPlotData())[source]¶
Renders the plot.
- Parameters:
context (QgsRenderContext)
plotContext (QgsPlotRenderContext)
plotData (
QgsPlotData
= QgsPlotData())
- virtual renderContent(self, context: QgsRenderContext, plotContext: QgsPlotRenderContext, plotArea: QRectF, plotData: QgsPlotData = QgsPlotData())[source]¶
Renders the plot content.
Subclasses can implement this method to render the actual plot content (e.g. bar charts, scatter plots). This method will be called after the chart background and grid are rendered, but before the chart border is rendered.
The default implementation does nothing.
The
plotArea
argument specifies that area of the plot which corresponds to the actual plot content. Implementations should take care to scale values accordingly to render points correctly inside this plot area.- Parameters:
context (QgsRenderContext)
plotContext (QgsPlotRenderContext)
plotArea (QRectF)
plotData (
QgsPlotData
= QgsPlotData())
- setMargins(self, margins: QgsMargins)[source]¶
Sets the
margins
of the plot area (in millimeters)See also
- Parameters:
margins (QgsMargins)