diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py
index dcbb3b9d..2afb93db 100644
--- a/bec_widgets/cli/client.py
+++ b/bec_widgets/cli/client.py
@@ -1653,6 +1653,15 @@ class BECPlotBase(RPCBase):
y(bool): Show grid on the y-axis.
"""
+ @rpc_call
+ def set_outer_axes(self, show: "bool" = True):
+ """
+ Set the outer axes of the plot widget.
+
+ Args:
+ show(bool): Show the outer axes.
+ """
+
@rpc_call
def lock_aspect_ratio(self, lock):
"""
@@ -2317,7 +2326,7 @@ class DapComboBox(RPCBase):
@rpc_call
def select_y_axis(self, y_axis: str):
"""
- Receive update signal for the y axis.
+ Slot to update the y axis.
Args:
y_axis(str): Y axis.
@@ -2326,19 +2335,19 @@ class DapComboBox(RPCBase):
@rpc_call
def select_x_axis(self, x_axis: str):
"""
- Receive update signal for the x axis.
+ Slot to update the x axis.
Args:
x_axis(str): X axis.
"""
@rpc_call
- def select_fit(self, fit_name: str | None):
+ def select_fit_model(self, fit_name: str | None):
"""
- Select current fit.
+ Slot to update the fit model.
- Args:
- default_device(str): Default device name.
+ Args:
+ default_device(str): Default device name.
"""
diff --git a/bec_widgets/widgets/figure/plots/axis_settings.py b/bec_widgets/widgets/figure/plots/axis_settings.py
index 75d55d0a..c54059cd 100644
--- a/bec_widgets/widgets/figure/plots/axis_settings.py
+++ b/bec_widgets/widgets/figure/plots/axis_settings.py
@@ -31,6 +31,7 @@ class AxisSettings(SettingWidget):
# Top Box
WidgetIO.set_value(self.ui.plot_title, axis_config["title"])
+ self.ui.switch_outer_axes.checked = axis_config["outer_axes"]
# X Axis Box
WidgetIO.set_value(self.ui.x_label, axis_config["x_label"])
@@ -63,6 +64,7 @@ class AxisSettings(SettingWidget):
@Slot()
def accept_changes(self):
title = WidgetIO.get_value(self.ui.plot_title)
+ outer_axes = self.ui.switch_outer_axes.checked
# X Axis
x_label = WidgetIO.get_value(self.ui.x_label)
@@ -86,3 +88,4 @@ class AxisSettings(SettingWidget):
y_lim=y_lim,
)
self.target_widget.set_grid(x_grid, y_grid)
+ self.target_widget.set_outer_axes(outer_axes)
diff --git a/bec_widgets/widgets/figure/plots/axis_settings.ui b/bec_widgets/widgets/figure/plots/axis_settings.ui
index 04929dcd..dae3a82a 100644
--- a/bec_widgets/widgets/figure/plots/axis_settings.ui
+++ b/bec_widgets/widgets/figure/plots/axis_settings.ui
@@ -6,8 +6,8 @@
0
0
- 417
- 250
+ 427
+ 270
@@ -26,7 +26,28 @@
Form
- -
+
-
+
+
-
+
+
+ Plot Title
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Outer Axes
+
+
+
+ -
Y Axis
@@ -120,7 +141,7 @@
- -
+
-
X Axis
@@ -214,22 +235,22 @@
- -
-
-
-
-
-
- Plot Title
-
-
-
- -
-
-
-
+ -
+
+
+ false
+
+
+
+
+ ToggleSwitch
+ QWidget
+
+
+
diff --git a/bec_widgets/widgets/figure/plots/plot_base.py b/bec_widgets/widgets/figure/plots/plot_base.py
index b04c457a..e0a7dcbb 100644
--- a/bec_widgets/widgets/figure/plots/plot_base.py
+++ b/bec_widgets/widgets/figure/plots/plot_base.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+from collections import defaultdict
from typing import Literal, Optional
import bec_qthemes
@@ -31,6 +32,7 @@ class AxisConfig(BaseModel):
y_lim: Optional[tuple] = Field(None, description="The limits of the y-axis.")
x_grid: bool = Field(False, description="Show grid on the x-axis.")
y_grid: bool = Field(False, description="Show grid on the y-axis.")
+ outer_axes: bool = Field(False, description="Show the outer axes of the plot widget.")
model_config: dict = {"validate_assignment": True}
@@ -75,6 +77,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
"set_x_lim",
"set_y_lim",
"set_grid",
+ "set_outer_axes",
"lock_aspect_ratio",
"export",
"remove",
@@ -336,6 +339,17 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
self.config.axis.x_grid = x
self.config.axis.y_grid = y
+ def set_outer_axes(self, show: bool = True):
+ """
+ Set the outer axes of the plot widget.
+
+ Args:
+ show(bool): Show the outer axes.
+ """
+ self.plot_item.showAxis("top", show)
+ self.plot_item.showAxis("right", show)
+ self.config.axis.outer_axes = show
+
def add_legend(self):
"""Add legend to the plot"""
self.plot_item.addLegend()
diff --git a/bec_widgets/widgets/waveform/waveform_widget.py b/bec_widgets/widgets/waveform/waveform_widget.py
index e3be47fe..443f8c88 100644
--- a/bec_widgets/widgets/waveform/waveform_widget.py
+++ b/bec_widgets/widgets/waveform/waveform_widget.py
@@ -560,6 +560,15 @@ class BECWaveformWidget(BECWidget, QWidget):
"""
self.waveform.set_grid(x_grid, y_grid)
+ def set_outer_axes(self, show: bool):
+ """
+ Set the outer axes visibility of the plot widget.
+
+ Args:
+ show(bool): Visibility of the outer axes.
+ """
+ self.waveform.set_outer_axes(show)
+
def lock_aspect_ratio(self, lock: bool):
"""
Lock the aspect ratio of the plot widget.
@@ -633,10 +642,7 @@ class BECWaveformWidget(BECWidget, QWidget):
def main(): # pragma: no cover
from qtpy.QtWidgets import QApplication
- from bec_widgets.utils.colors import set_theme
-
app = QApplication(sys.argv)
- set_theme("auto")
widget = BECWaveformWidget()
widget.show()
sys.exit(app.exec_())
diff --git a/tests/unit_tests/test_bec_motor_map.py b/tests/unit_tests/test_bec_motor_map.py
index c6518dab..ab731b91 100644
--- a/tests/unit_tests/test_bec_motor_map.py
+++ b/tests/unit_tests/test_bec_motor_map.py
@@ -177,6 +177,7 @@ def test_motor_map_init_from_config(qtbot, mocked_client):
"y_lim": None,
"x_grid": True,
"y_grid": True,
+ "outer_axes": False,
},
"signals": {
"source": "device_readback",
diff --git a/tests/unit_tests/test_waveform1d.py b/tests/unit_tests/test_waveform1d.py
index 1da60aa1..5a30ebd4 100644
--- a/tests/unit_tests/test_waveform1d.py
+++ b/tests/unit_tests/test_waveform1d.py
@@ -72,6 +72,7 @@ def test_create_waveform1D_by_config(qtbot, mocked_client):
"y_lim": None,
"x_grid": False,
"y_grid": False,
+ "outer_axes": False,
},
"color_palette": "magma",
"curves": {