From 13f263142ea342af6bba738ba764b916e8c4cfef Mon Sep 17 00:00:00 2001 From: Sietze van Buuren Date: Sat, 9 Nov 2024 16:13:43 +0100 Subject: [PATCH] feat: Add azimuth and elevation properties for 3D Axis Signed-off-by: Sietze van Buuren --- mlpyqtgraph/axes.py | 16 ++++++++++++++++ mlpyqtgraph/workers.py | 2 ++ 2 files changed, 18 insertions(+) diff --git a/mlpyqtgraph/axes.py b/mlpyqtgraph/axes.py index 2b64ab6..e372e7c 100644 --- a/mlpyqtgraph/axes.py +++ b/mlpyqtgraph/axes.py @@ -397,6 +397,22 @@ def line(self, *args, **kwargs): self.set_projection_method(*args, method=kwargs['projection']) self.update_grid_axes(*args, **kwargs) + @property + def azimuth(self): + return self.view().cameraParams()['azimuth'] + + @azimuth.setter + def azimuth(self, value): + self.view().setCameraParams(azimuth=value) + + @property + def elevation(self): + return self.view().cameraParams()['elevation'] + + @elevation.setter + def elevation(self, value): + self.view().setCameraParams(elevation=value) + def delete(self): """ Closes the axis """ diff --git a/mlpyqtgraph/workers.py b/mlpyqtgraph/workers.py index 7d3f64e..ebae13b 100644 --- a/mlpyqtgraph/workers.py +++ b/mlpyqtgraph/workers.py @@ -23,6 +23,8 @@ class AxisWorker(containers.WorkerItem): yticks = factory.attribute() set_xticks = factory.method() set_yticks = factory.method() + azimuth = factory.attribute() + elevation = factory.attribute() class FigureWorker(containers.WorkerItem):