From b10efc0f400fe36f7cb0d5998214d50943934d7b Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Wed, 5 Nov 2025 19:14:00 +0100 Subject: [PATCH] feat(plot_base): invert x/y axis --- bec_widgets/widgets/plots/plot_base.py | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/bec_widgets/widgets/plots/plot_base.py b/bec_widgets/widgets/plots/plot_base.py index 1e112ed7..3e6f71b8 100644 --- a/bec_widgets/widgets/plots/plot_base.py +++ b/bec_widgets/widgets/plots/plot_base.py @@ -831,6 +831,40 @@ class PlotBase(BECWidget, QWidget): self._apply_y_label() self.property_changed.emit("inner_axes", value) + @SafeProperty(bool, doc="Invert X axis.") + def invert_x(self) -> bool: + """ + Invert X axis. + """ + return self.plot_item.vb.state.get("xInverted", False) + + @invert_x.setter + def invert_x(self, value: bool): + """ + Invert X axis. + + Args: + value(bool): The value to set. + """ + self.plot_item.vb.invertX(value) + + @SafeProperty(bool, doc="Invert Y axis.") + def invert_y(self) -> bool: + """ + Invert Y axis. + """ + return self.plot_item.vb.state.get("yInverted", False) + + @invert_y.setter + def invert_y(self, value: bool): + """ + Invert Y axis. + + Args: + value(bool): The value to set. + """ + self.plot_item.vb.invertY(value) + @SafeProperty(bool, doc="Lock aspect ratio of the plot widget.") def lock_aspect_ratio(self) -> bool: """