Q3DScatter#

The Q3DScatter class provides methods for rendering 3D scatter graphs. More

Inheritance diagram of PySide6.QtDataVisualization.Q3DScatter

Synopsis#

Properties#

Functions#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

This class enables developers to render scatter graphs in 3D and to view them by rotating the scene freely. Rotation is done by holding down the right mouse button and moving the mouse. Zooming is done by mouse wheel. Selection, if enabled, is done by left mouse button. The scene can be reset to default camera view by clicking mouse wheel. In touch devices rotation is done by tap-and-move, selection by tap-and-hold and zoom by pinch.

If no axes are set explicitly to Q3DScatter , temporary default axes with no labels are created. These default axes can be modified via axis accessors, but as soon any axis is set explicitly for the orientation, the default axis for that orientation is destroyed.

Q3DScatter supports more than one series visible at the same time.

How to construct a minimal Q3DScatter graph#

First, construct Q3DScatter . Since we are running the graph as top level window in this example, we need to clear the Qt::FramelessWindowHint flag, which gets set by default:

scatter = Q3DScatter()
scatter.setFlags(scatter.flags() ^ Qt.FramelessWindowHint)

Now Q3DScatter is ready to receive data to be rendered. Add one series of 3 QVector3D items:

series = QScatter3DSeries()
data = QScatterDataArray()
data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f)
series.dataProxy().addItems(data)
scatter.addSeries(series)

Finally you will need to set it visible:

scatter.show()

The complete code needed to create and display this graph is:

from PySide6 import QtDataVisualization
if __name__ == "__main__":

    qputenv("QSG_RHI_BACKEND", "opengl")
    app = QGuiApplication(argc, argv)
    scatter = Q3DScatter()
    scatter.setFlags(scatter.flags() ^ Qt.FramelessWindowHint)
    series = QScatter3DSeries()
    data = QScatterDataArray()
    data << QVector3D(0.5f, 0.5f, 0.5f) << QVector3D(-0.3f, -0.5f, -0.4f) << QVector3D(0.0f, -0.3f, 0.2f)
    series.dataProxy().addItems(data)
    scatter.addSeries(series)
    scatter.show()
    sys.exit(app.exec())

And this is what those few lines of code produce:

../../_images/q3dscatter-minimal.png

The scene can be rotated, zoomed into, and an item can be selected to view its position, but no other interaction is included in this minimal code example. You can learn more by familiarizing yourself with the examples provided, like the Scatter Graph .

class PySide6.QtDataVisualization.Q3DScatter([format=None[, parent=None]])#
Parameters:

Constructs a new 3D scatter graph with optional parent window and surface format.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtDataVisualization.Q3DScatter.axisX: PySide6.QtDataVisualization.QValue3DAxis#

This property holds The active x-axis..

Access functions:
property PᅟySide6.QtDataVisualization.Q3DScatter.axisY: PySide6.QtDataVisualization.QValue3DAxis#

This property holds The active y-axis..

Access functions:
property PᅟySide6.QtDataVisualization.Q3DScatter.axisZ: PySide6.QtDataVisualization.QValue3DAxis#

This property holds The active z-axis..

Access functions:
property PᅟySide6.QtDataVisualization.Q3DScatter.selectedSeries: PySide6.QtDataVisualization.QScatter3DSeries#

This property holds The selected series or null..

Access functions:
PySide6.QtDataVisualization.Q3DScatter.addAxis(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Adds axis to the graph. The axes added via addAxis are not yet taken to use, addAxis is simply used to give the ownership of the axis to the graph. The axis must not be null or added to another graph.

PySide6.QtDataVisualization.Q3DScatter.addSeries(series)#
Parameters:

seriesPySide6.QtDataVisualization.QScatter3DSeries

Adds the series to the graph. A graph can contain multiple series, but has only one set of axes. If the newly added series has specified a selected item, it will be highlighted and any existing selection will be cleared. Only one added series can have an active selection.

See also

hasSeries()

PySide6.QtDataVisualization.Q3DScatter.axes()#

Returns the list of all added axes.

See also

addAxis()

PySide6.QtDataVisualization.Q3DScatter.axisX()#
Return type:

PySide6.QtDataVisualization.QValue3DAxis

See also

setAxisX()

Getter of property axisX .

PySide6.QtDataVisualization.Q3DScatter.axisXChanged(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Notification signal of property axisX .

PySide6.QtDataVisualization.Q3DScatter.axisY()#
Return type:

PySide6.QtDataVisualization.QValue3DAxis

See also

setAxisY()

Getter of property axisY .

PySide6.QtDataVisualization.Q3DScatter.axisYChanged(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Notification signal of property axisY .

PySide6.QtDataVisualization.Q3DScatter.axisZ()#
Return type:

PySide6.QtDataVisualization.QValue3DAxis

Returns the used z-axis.

See also

setAxisZ()

Getter of property axisZ .

PySide6.QtDataVisualization.Q3DScatter.axisZChanged(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Notification signal of property axisZ .

PySide6.QtDataVisualization.Q3DScatter.releaseAxis(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Releases the ownership of the axis back to the caller, if it is added to this graph. If the released axis is in use, a new default axis will be created and set active.

If the default axis is released and added back later, it behaves as any other axis would.

PySide6.QtDataVisualization.Q3DScatter.removeSeries(series)#
Parameters:

seriesPySide6.QtDataVisualization.QScatter3DSeries

Removes the series from the graph.

See also

hasSeries()

PySide6.QtDataVisualization.Q3DScatter.selectedSeries()#
Return type:

PySide6.QtDataVisualization.QScatter3DSeries

Getter of property selectedSeries .

PySide6.QtDataVisualization.Q3DScatter.selectedSeriesChanged(series)#
Parameters:

seriesPySide6.QtDataVisualization.QScatter3DSeries

Notification signal of property selectedSeries .

PySide6.QtDataVisualization.Q3DScatter.seriesList()#

Returns the list of series added to this graph.

See also

hasSeries()

PySide6.QtDataVisualization.Q3DScatter.setAxisX(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Sets axis as the active x-axis. Implicitly calls addAxis() to transfer the ownership of the axis to this graph.

If axis is null, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is set explicitly to the same orientation.

Setter of property axisX .

PySide6.QtDataVisualization.Q3DScatter.setAxisY(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Sets axis as the active y-axis. Implicitly calls addAxis() to transfer the ownership of the axis to this graph.

If axis is null, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is set explicitly to the same orientation.

Setter of property axisY .

PySide6.QtDataVisualization.Q3DScatter.setAxisZ(axis)#
Parameters:

axisPySide6.QtDataVisualization.QValue3DAxis

Sets axis as the active z-axis. Implicitly calls addAxis() to transfer the ownership of the axis to this graph.

If axis is null, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is set explicitly to the same orientation.

Setter of property axisZ .