mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
docs(plot_base): update docstrings for properties and setters
This commit is contained in:
@ -3653,42 +3653,42 @@ class Waveform(RPCBase):
|
|||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_toolbar(self) -> "bool":
|
def enable_toolbar(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show Toolbar.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@enable_toolbar.setter
|
@enable_toolbar.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_toolbar(self) -> "bool":
|
def enable_toolbar(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show Toolbar.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_side_panel(self) -> "bool":
|
def enable_side_panel(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show Side Panel
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@enable_side_panel.setter
|
@enable_side_panel.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_side_panel(self) -> "bool":
|
def enable_side_panel(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show Side Panel
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_fps_monitor(self) -> "bool":
|
def enable_fps_monitor(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Enable the FPS monitor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@enable_fps_monitor.setter
|
@enable_fps_monitor.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def enable_fps_monitor(self) -> "bool":
|
def enable_fps_monitor(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Enable the FPS monitor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@rpc_call
|
@rpc_call
|
||||||
@ -3706,210 +3706,210 @@ class Waveform(RPCBase):
|
|||||||
@rpc_call
|
@rpc_call
|
||||||
def title(self) -> "str":
|
def title(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
Set title of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@title.setter
|
@title.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def title(self) -> "str":
|
def title(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
Set title of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_label(self) -> "str":
|
def x_label(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
The set label for the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@x_label.setter
|
@x_label.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_label(self) -> "str":
|
def x_label(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
The set label for the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_label(self) -> "str":
|
def y_label(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
The set label for the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@y_label.setter
|
@y_label.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_label(self) -> "str":
|
def y_label(self) -> "str":
|
||||||
"""
|
"""
|
||||||
None
|
The set label for the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_limits(self) -> "QPointF":
|
def x_limits(self) -> "QPointF":
|
||||||
"""
|
"""
|
||||||
None
|
Get the x limits of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@x_limits.setter
|
@x_limits.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_limits(self) -> "QPointF":
|
def x_limits(self) -> "QPointF":
|
||||||
"""
|
"""
|
||||||
None
|
Get the x limits of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_limits(self) -> "QPointF":
|
def y_limits(self) -> "QPointF":
|
||||||
"""
|
"""
|
||||||
None
|
Get the y limits of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@y_limits.setter
|
@y_limits.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_limits(self) -> "QPointF":
|
def y_limits(self) -> "QPointF":
|
||||||
"""
|
"""
|
||||||
None
|
Get the y limits of the plot.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_grid(self) -> "bool":
|
def x_grid(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show grid on the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@x_grid.setter
|
@x_grid.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_grid(self) -> "bool":
|
def x_grid(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show grid on the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_grid(self) -> "bool":
|
def y_grid(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show grid on the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@y_grid.setter
|
@y_grid.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_grid(self) -> "bool":
|
def y_grid(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show grid on the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def inner_axes(self) -> "bool":
|
def inner_axes(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show inner axes of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@inner_axes.setter
|
@inner_axes.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def inner_axes(self) -> "bool":
|
def inner_axes(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show inner axes of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def outer_axes(self) -> "bool":
|
def outer_axes(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show the outer axes of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@outer_axes.setter
|
@outer_axes.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def outer_axes(self) -> "bool":
|
def outer_axes(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Show the outer axes of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def lock_aspect_ratio(self) -> "bool":
|
def lock_aspect_ratio(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Lock aspect ratio of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@lock_aspect_ratio.setter
|
@lock_aspect_ratio.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def lock_aspect_ratio(self) -> "bool":
|
def lock_aspect_ratio(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Lock aspect ratio of the plot widget.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def auto_range_x(self) -> "bool":
|
def auto_range_x(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set auto range for the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@auto_range_x.setter
|
@auto_range_x.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def auto_range_x(self) -> "bool":
|
def auto_range_x(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set auto range for the x-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def auto_range_y(self) -> "bool":
|
def auto_range_y(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set auto range for the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@auto_range_y.setter
|
@auto_range_y.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def auto_range_y(self) -> "bool":
|
def auto_range_y(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set auto range for the y-axis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_log(self) -> "bool":
|
def x_log(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set X-axis to log scale if True, linear if False.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@x_log.setter
|
@x_log.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def x_log(self) -> "bool":
|
def x_log(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set X-axis to log scale if True, linear if False.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_log(self) -> "bool":
|
def y_log(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set Y-axis to log scale if True, linear if False.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@y_log.setter
|
@y_log.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def y_log(self) -> "bool":
|
def y_log(self) -> "bool":
|
||||||
"""
|
"""
|
||||||
None
|
Set Y-axis to log scale if True, linear if False.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def legend_label_size(self) -> "int":
|
def legend_label_size(self) -> "int":
|
||||||
"""
|
"""
|
||||||
None
|
The font size of the legend font.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@legend_label_size.setter
|
@legend_label_size.setter
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def legend_label_size(self) -> "int":
|
def legend_label_size(self) -> "int":
|
||||||
"""
|
"""
|
||||||
None
|
The font size of the legend font.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@rpc_call
|
@rpc_call
|
||||||
|
@ -228,10 +228,19 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
################################################################################
|
################################################################################
|
||||||
@property
|
@property
|
||||||
def ui_mode(self) -> UIMode:
|
def ui_mode(self) -> UIMode:
|
||||||
|
"""
|
||||||
|
Get the UI mode.
|
||||||
|
"""
|
||||||
return self._ui_mode
|
return self._ui_mode
|
||||||
|
|
||||||
@ui_mode.setter
|
@ui_mode.setter
|
||||||
def ui_mode(self, mode: UIMode):
|
def ui_mode(self, mode: UIMode):
|
||||||
|
"""
|
||||||
|
Set the UI mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
mode(UIMode): The UI mode to set.
|
||||||
|
"""
|
||||||
if not isinstance(mode, UIMode):
|
if not isinstance(mode, UIMode):
|
||||||
raise ValueError("ui_mode must be an instance of UIMode")
|
raise ValueError("ui_mode must be an instance of UIMode")
|
||||||
self._ui_mode = mode
|
self._ui_mode = mode
|
||||||
@ -257,10 +266,19 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(bool, doc="Enable popups setting dialogs for the plot widget.")
|
@SafeProperty(bool, doc="Enable popups setting dialogs for the plot widget.")
|
||||||
def enable_popups(self):
|
def enable_popups(self):
|
||||||
|
"""
|
||||||
|
Enable popups setting dialogs for the plot widget.
|
||||||
|
"""
|
||||||
return self.ui_mode == UIMode.POPUP
|
return self.ui_mode == UIMode.POPUP
|
||||||
|
|
||||||
@enable_popups.setter
|
@enable_popups.setter
|
||||||
def enable_popups(self, value: bool):
|
def enable_popups(self, value: bool):
|
||||||
|
"""
|
||||||
|
Set the popups setting dialogs for the plot widget.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
if value:
|
if value:
|
||||||
self.ui_mode = UIMode.POPUP
|
self.ui_mode = UIMode.POPUP
|
||||||
else:
|
else:
|
||||||
@ -269,10 +287,19 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(bool, doc="Show Side Panel")
|
@SafeProperty(bool, doc="Show Side Panel")
|
||||||
def enable_side_panel(self) -> bool:
|
def enable_side_panel(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show Side Panel
|
||||||
|
"""
|
||||||
return self.ui_mode == UIMode.SIDE
|
return self.ui_mode == UIMode.SIDE
|
||||||
|
|
||||||
@enable_side_panel.setter
|
@enable_side_panel.setter
|
||||||
def enable_side_panel(self, value: bool):
|
def enable_side_panel(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show Side Panel
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
if value:
|
if value:
|
||||||
self.ui_mode = UIMode.SIDE
|
self.ui_mode = UIMode.SIDE
|
||||||
else:
|
else:
|
||||||
@ -281,10 +308,19 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(bool, doc="Show Toolbar")
|
@SafeProperty(bool, doc="Show Toolbar")
|
||||||
def enable_toolbar(self) -> bool:
|
def enable_toolbar(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show Toolbar.
|
||||||
|
"""
|
||||||
return self.toolbar.isVisible()
|
return self.toolbar.isVisible()
|
||||||
|
|
||||||
@enable_toolbar.setter
|
@enable_toolbar.setter
|
||||||
def enable_toolbar(self, value: bool):
|
def enable_toolbar(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show Toolbar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
if value:
|
if value:
|
||||||
# Disable popup mode
|
# Disable popup mode
|
||||||
if self._popups:
|
if self._popups:
|
||||||
@ -304,10 +340,19 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(bool, doc="Enable the FPS monitor.")
|
@SafeProperty(bool, doc="Enable the FPS monitor.")
|
||||||
def enable_fps_monitor(self) -> bool:
|
def enable_fps_monitor(self) -> bool:
|
||||||
|
"""
|
||||||
|
Enable the FPS monitor.
|
||||||
|
"""
|
||||||
return self.fps_label.isVisible()
|
return self.fps_label.isVisible()
|
||||||
|
|
||||||
@enable_fps_monitor.setter
|
@enable_fps_monitor.setter
|
||||||
def enable_fps_monitor(self, value: bool):
|
def enable_fps_monitor(self, value: bool):
|
||||||
|
"""
|
||||||
|
Enable the FPS monitor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
if value and self.fps_monitor is None:
|
if value and self.fps_monitor is None:
|
||||||
self.hook_fps_monitor()
|
self.hook_fps_monitor()
|
||||||
elif not value and self.fps_monitor is not None:
|
elif not value and self.fps_monitor is not None:
|
||||||
@ -374,19 +419,37 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(str, doc="The title of the axes.")
|
@SafeProperty(str, doc="The title of the axes.")
|
||||||
def title(self) -> str:
|
def title(self) -> str:
|
||||||
|
"""
|
||||||
|
Set title of the plot.
|
||||||
|
"""
|
||||||
return self.plot_item.titleLabel.text
|
return self.plot_item.titleLabel.text
|
||||||
|
|
||||||
@title.setter
|
@title.setter
|
||||||
def title(self, value: str):
|
def title(self, value: str):
|
||||||
|
"""
|
||||||
|
Set title of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(str): The title to set.
|
||||||
|
"""
|
||||||
self.plot_item.setTitle(value)
|
self.plot_item.setTitle(value)
|
||||||
self.property_changed.emit("title", value)
|
self.property_changed.emit("title", value)
|
||||||
|
|
||||||
@SafeProperty(str, doc="The text of the x label")
|
@SafeProperty(str, doc="The text of the x label")
|
||||||
def x_label(self) -> str:
|
def x_label(self) -> str:
|
||||||
|
"""
|
||||||
|
The set label for the x-axis.
|
||||||
|
"""
|
||||||
return self._user_x_label
|
return self._user_x_label
|
||||||
|
|
||||||
@x_label.setter
|
@x_label.setter
|
||||||
def x_label(self, value: str):
|
def x_label(self, value: str):
|
||||||
|
"""
|
||||||
|
The set label for the x-axis.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(str): The label to set.
|
||||||
|
"""
|
||||||
self._user_x_label = value
|
self._user_x_label = value
|
||||||
self._apply_x_label()
|
self._apply_x_label()
|
||||||
self.property_changed.emit("x_label", self._user_x_label)
|
self.property_changed.emit("x_label", self._user_x_label)
|
||||||
@ -425,10 +488,18 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty(str, doc="The text of the y label")
|
@SafeProperty(str, doc="The text of the y label")
|
||||||
def y_label(self) -> str:
|
def y_label(self) -> str:
|
||||||
|
"""
|
||||||
|
The set label for the y-axis.
|
||||||
|
"""
|
||||||
return self.plot_item.getAxis("left").labelText
|
return self.plot_item.getAxis("left").labelText
|
||||||
|
|
||||||
@y_label.setter
|
@y_label.setter
|
||||||
def y_label(self, value: str):
|
def y_label(self, value: str):
|
||||||
|
"""
|
||||||
|
The set label for the y-axis.
|
||||||
|
Args:
|
||||||
|
value(str): The label to set.
|
||||||
|
"""
|
||||||
self.plot_item.setLabel("left", text=value)
|
self.plot_item.setLabel("left", text=value)
|
||||||
self.property_changed.emit("y_label", value)
|
self.property_changed.emit("y_label", value)
|
||||||
|
|
||||||
@ -457,37 +528,74 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty("QPointF")
|
@SafeProperty("QPointF")
|
||||||
def x_limits(self) -> QPointF:
|
def x_limits(self) -> QPointF:
|
||||||
|
"""
|
||||||
|
Get the x limits of the plot.
|
||||||
|
"""
|
||||||
current_lim = self.plot_item.vb.viewRange()[0]
|
current_lim = self.plot_item.vb.viewRange()[0]
|
||||||
return QPointF(current_lim[0], current_lim[1])
|
return QPointF(current_lim[0], current_lim[1])
|
||||||
|
|
||||||
@x_limits.setter
|
@x_limits.setter
|
||||||
def x_limits(self, value):
|
def x_limits(self, value):
|
||||||
|
"""
|
||||||
|
Set the x limits of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(QPointF|tuple|list): The x limits to set.
|
||||||
|
"""
|
||||||
if isinstance(value, (tuple, list)):
|
if isinstance(value, (tuple, list)):
|
||||||
value = self._tuple_to_qpointf(value)
|
value = self._tuple_to_qpointf(value)
|
||||||
self.plot_item.vb.setXRange(value.x(), value.y(), padding=0)
|
self.plot_item.vb.setXRange(value.x(), value.y(), padding=0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def x_lim(self) -> tuple:
|
def x_lim(self) -> tuple:
|
||||||
|
"""
|
||||||
|
Get the x limits of the plot.
|
||||||
|
"""
|
||||||
return (self.x_limits.x(), self.x_limits.y())
|
return (self.x_limits.x(), self.x_limits.y())
|
||||||
|
|
||||||
@x_lim.setter
|
@x_lim.setter
|
||||||
def x_lim(self, value):
|
def x_lim(self, value):
|
||||||
|
"""
|
||||||
|
Set the x limits of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(tuple): The x limits to set.
|
||||||
|
"""
|
||||||
self.x_limits = value
|
self.x_limits = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def x_min(self) -> float:
|
def x_min(self) -> float:
|
||||||
|
"""
|
||||||
|
Get the minimum x limit of the plot.
|
||||||
|
|
||||||
|
"""
|
||||||
return self.x_limits.x()
|
return self.x_limits.x()
|
||||||
|
|
||||||
@x_min.setter
|
@x_min.setter
|
||||||
def x_min(self, value: float):
|
def x_min(self, value: float):
|
||||||
|
"""
|
||||||
|
Set the minimum x limit of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(float): The minimum x limit to set.
|
||||||
|
"""
|
||||||
self.x_limits = (value, self.x_lim[1])
|
self.x_limits = (value, self.x_lim[1])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def x_max(self) -> float:
|
def x_max(self) -> float:
|
||||||
|
"""
|
||||||
|
Get the maximum x limit of the plot.
|
||||||
|
"""
|
||||||
return self.x_limits.y()
|
return self.x_limits.y()
|
||||||
|
|
||||||
@x_max.setter
|
@x_max.setter
|
||||||
def x_max(self, value: float):
|
def x_max(self, value: float):
|
||||||
|
"""
|
||||||
|
Set the maximum x limit of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(float): The maximum x limit to set.
|
||||||
|
"""
|
||||||
self.x_limits = (self.x_lim[0], value)
|
self.x_limits = (self.x_lim[0], value)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -496,121 +604,241 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@SafeProperty("QPointF")
|
@SafeProperty("QPointF")
|
||||||
def y_limits(self) -> QPointF:
|
def y_limits(self) -> QPointF:
|
||||||
|
"""
|
||||||
|
Get the y limits of the plot.
|
||||||
|
"""
|
||||||
current_lim = self.plot_item.vb.viewRange()[1]
|
current_lim = self.plot_item.vb.viewRange()[1]
|
||||||
return QPointF(current_lim[0], current_lim[1])
|
return QPointF(current_lim[0], current_lim[1])
|
||||||
|
|
||||||
@y_limits.setter
|
@y_limits.setter
|
||||||
def y_limits(self, value):
|
def y_limits(self, value):
|
||||||
|
"""
|
||||||
|
Set the y limits of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(QPointF|tuple|list): The y limits to set.
|
||||||
|
"""
|
||||||
if isinstance(value, (tuple, list)):
|
if isinstance(value, (tuple, list)):
|
||||||
value = self._tuple_to_qpointf(value)
|
value = self._tuple_to_qpointf(value)
|
||||||
self.plot_item.vb.setYRange(value.x(), value.y(), padding=0)
|
self.plot_item.vb.setYRange(value.x(), value.y(), padding=0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def y_lim(self) -> tuple:
|
def y_lim(self) -> tuple:
|
||||||
|
"""
|
||||||
|
Get the y limits of the plot.
|
||||||
|
"""
|
||||||
return (self.y_limits.x(), self.y_limits.y())
|
return (self.y_limits.x(), self.y_limits.y())
|
||||||
|
|
||||||
@y_lim.setter
|
@y_lim.setter
|
||||||
def y_lim(self, value):
|
def y_lim(self, value):
|
||||||
|
"""
|
||||||
|
Set the y limits of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(tuple): The y limits to set.
|
||||||
|
"""
|
||||||
self.y_limits = value
|
self.y_limits = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def y_min(self) -> float:
|
def y_min(self) -> float:
|
||||||
|
"""
|
||||||
|
Get the minimum y limit of the plot.
|
||||||
|
"""
|
||||||
return self.y_limits.x()
|
return self.y_limits.x()
|
||||||
|
|
||||||
@y_min.setter
|
@y_min.setter
|
||||||
def y_min(self, value: float):
|
def y_min(self, value: float):
|
||||||
|
"""
|
||||||
|
Set the minimum y limit of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(float): The minimum y limit to set.
|
||||||
|
"""
|
||||||
self.y_limits = (value, self.y_lim[1])
|
self.y_limits = (value, self.y_lim[1])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def y_max(self) -> float:
|
def y_max(self) -> float:
|
||||||
|
"""
|
||||||
|
Get the maximum y limit of the plot.
|
||||||
|
"""
|
||||||
return self.y_limits.y()
|
return self.y_limits.y()
|
||||||
|
|
||||||
@y_max.setter
|
@y_max.setter
|
||||||
def y_max(self, value: float):
|
def y_max(self, value: float):
|
||||||
|
"""
|
||||||
|
Set the maximum y limit of the plot.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(float): The maximum y limit to set.
|
||||||
|
"""
|
||||||
self.y_limits = (self.y_lim[0], value)
|
self.y_limits = (self.y_lim[0], value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Show grid on the x-axis.")
|
@SafeProperty(bool, doc="Show grid on the x-axis.")
|
||||||
def x_grid(self) -> bool:
|
def x_grid(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show grid on the x-axis.
|
||||||
|
"""
|
||||||
return self.plot_item.ctrl.xGridCheck.isChecked()
|
return self.plot_item.ctrl.xGridCheck.isChecked()
|
||||||
|
|
||||||
@x_grid.setter
|
@x_grid.setter
|
||||||
def x_grid(self, value: bool):
|
def x_grid(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show grid on the x-axis.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.showGrid(x=value)
|
self.plot_item.showGrid(x=value)
|
||||||
self.property_changed.emit("x_grid", value)
|
self.property_changed.emit("x_grid", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Show grid on the y-axis.")
|
@SafeProperty(bool, doc="Show grid on the y-axis.")
|
||||||
def y_grid(self) -> bool:
|
def y_grid(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show grid on the y-axis.
|
||||||
|
"""
|
||||||
return self.plot_item.ctrl.yGridCheck.isChecked()
|
return self.plot_item.ctrl.yGridCheck.isChecked()
|
||||||
|
|
||||||
@y_grid.setter
|
@y_grid.setter
|
||||||
def y_grid(self, value: bool):
|
def y_grid(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show grid on the y-axis.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.showGrid(y=value)
|
self.plot_item.showGrid(y=value)
|
||||||
self.property_changed.emit("y_grid", value)
|
self.property_changed.emit("y_grid", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Set X-axis to log scale if True, linear if False.")
|
@SafeProperty(bool, doc="Set X-axis to log scale if True, linear if False.")
|
||||||
def x_log(self) -> bool:
|
def x_log(self) -> bool:
|
||||||
|
"""
|
||||||
|
Set X-axis to log scale if True, linear if False.
|
||||||
|
"""
|
||||||
return bool(self.plot_item.vb.state.get("logMode", [False, False])[0])
|
return bool(self.plot_item.vb.state.get("logMode", [False, False])[0])
|
||||||
|
|
||||||
@x_log.setter
|
@x_log.setter
|
||||||
def x_log(self, value: bool):
|
def x_log(self, value: bool):
|
||||||
|
"""
|
||||||
|
Set X-axis to log scale if True, linear if False.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.setLogMode(x=value)
|
self.plot_item.setLogMode(x=value)
|
||||||
self.property_changed.emit("x_log", value)
|
self.property_changed.emit("x_log", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Set Y-axis to log scale if True, linear if False.")
|
@SafeProperty(bool, doc="Set Y-axis to log scale if True, linear if False.")
|
||||||
def y_log(self) -> bool:
|
def y_log(self) -> bool:
|
||||||
|
"""
|
||||||
|
Set Y-axis to log scale if True, linear if False.
|
||||||
|
"""
|
||||||
return bool(self.plot_item.vb.state.get("logMode", [False, False])[1])
|
return bool(self.plot_item.vb.state.get("logMode", [False, False])[1])
|
||||||
|
|
||||||
@y_log.setter
|
@y_log.setter
|
||||||
def y_log(self, value: bool):
|
def y_log(self, value: bool):
|
||||||
|
"""
|
||||||
|
Set Y-axis to log scale if True, linear if False.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.setLogMode(y=value)
|
self.plot_item.setLogMode(y=value)
|
||||||
self.property_changed.emit("y_log", value)
|
self.property_changed.emit("y_log", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Show the outer axes of the plot widget.")
|
@SafeProperty(bool, doc="Show the outer axes of the plot widget.")
|
||||||
def outer_axes(self) -> bool:
|
def outer_axes(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show the outer axes of the plot widget.
|
||||||
|
"""
|
||||||
return self.plot_item.getAxis("top").isVisible()
|
return self.plot_item.getAxis("top").isVisible()
|
||||||
|
|
||||||
@outer_axes.setter
|
@outer_axes.setter
|
||||||
def outer_axes(self, value: bool):
|
def outer_axes(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show the outer axes of the plot widget.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.showAxis("top", value)
|
self.plot_item.showAxis("top", value)
|
||||||
self.plot_item.showAxis("right", value)
|
self.plot_item.showAxis("right", value)
|
||||||
self.property_changed.emit("outer_axes", value)
|
self.property_changed.emit("outer_axes", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Show inner axes of the plot widget.")
|
@SafeProperty(bool, doc="Show inner axes of the plot widget.")
|
||||||
def inner_axes(self) -> bool:
|
def inner_axes(self) -> bool:
|
||||||
|
"""
|
||||||
|
Show inner axes of the plot widget.
|
||||||
|
"""
|
||||||
return self.plot_item.getAxis("bottom").isVisible()
|
return self.plot_item.getAxis("bottom").isVisible()
|
||||||
|
|
||||||
@inner_axes.setter
|
@inner_axes.setter
|
||||||
def inner_axes(self, value: bool):
|
def inner_axes(self, value: bool):
|
||||||
|
"""
|
||||||
|
Show inner axes of the plot widget.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.showAxis("bottom", value)
|
self.plot_item.showAxis("bottom", value)
|
||||||
self.plot_item.showAxis("left", value)
|
self.plot_item.showAxis("left", value)
|
||||||
self.property_changed.emit("inner_axes", value)
|
self.property_changed.emit("inner_axes", value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Lock aspect ratio of the plot widget.")
|
@SafeProperty(bool, doc="Lock aspect ratio of the plot widget.")
|
||||||
def lock_aspect_ratio(self) -> bool:
|
def lock_aspect_ratio(self) -> bool:
|
||||||
|
"""
|
||||||
|
Lock aspect ratio of the plot widget.
|
||||||
|
"""
|
||||||
return bool(self.plot_item.vb.getState()["aspectLocked"])
|
return bool(self.plot_item.vb.getState()["aspectLocked"])
|
||||||
|
|
||||||
@lock_aspect_ratio.setter
|
@lock_aspect_ratio.setter
|
||||||
def lock_aspect_ratio(self, value: bool):
|
def lock_aspect_ratio(self, value: bool):
|
||||||
|
"""
|
||||||
|
Lock aspect ratio of the plot widget.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.setAspectLocked(value)
|
self.plot_item.setAspectLocked(value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Set auto range for the x-axis.")
|
@SafeProperty(bool, doc="Set auto range for the x-axis.")
|
||||||
def auto_range_x(self) -> bool:
|
def auto_range_x(self) -> bool:
|
||||||
|
"""
|
||||||
|
Set auto range for the x-axis.
|
||||||
|
"""
|
||||||
return bool(self.plot_item.vb.getState()["autoRange"][0])
|
return bool(self.plot_item.vb.getState()["autoRange"][0])
|
||||||
|
|
||||||
@auto_range_x.setter
|
@auto_range_x.setter
|
||||||
def auto_range_x(self, value: bool):
|
def auto_range_x(self, value: bool):
|
||||||
|
"""
|
||||||
|
Set auto range for the x-axis.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.enableAutoRange(x=value)
|
self.plot_item.enableAutoRange(x=value)
|
||||||
|
|
||||||
@SafeProperty(bool, doc="Set auto range for the y-axis.")
|
@SafeProperty(bool, doc="Set auto range for the y-axis.")
|
||||||
def auto_range_y(self) -> bool:
|
def auto_range_y(self) -> bool:
|
||||||
|
"""
|
||||||
|
Set auto range for the y-axis.
|
||||||
|
"""
|
||||||
return bool(self.plot_item.vb.getState()["autoRange"][1])
|
return bool(self.plot_item.vb.getState()["autoRange"][1])
|
||||||
|
|
||||||
@auto_range_y.setter
|
@auto_range_y.setter
|
||||||
def auto_range_y(self, value: bool):
|
def auto_range_y(self, value: bool):
|
||||||
|
"""
|
||||||
|
Set auto range for the y-axis.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(bool): The value to set.
|
||||||
|
"""
|
||||||
self.plot_item.enableAutoRange(y=value)
|
self.plot_item.enableAutoRange(y=value)
|
||||||
|
|
||||||
@SafeProperty(int, doc="The font size of the legend font.")
|
@SafeProperty(int, doc="The font size of the legend font.")
|
||||||
def legend_label_size(self) -> int:
|
def legend_label_size(self) -> int:
|
||||||
|
"""
|
||||||
|
The font size of the legend font.
|
||||||
|
"""
|
||||||
if not self.plot_item.legend:
|
if not self.plot_item.legend:
|
||||||
return
|
return
|
||||||
scale = self.plot_item.legend.scale() * 9
|
scale = self.plot_item.legend.scale() * 9
|
||||||
@ -618,6 +846,12 @@ class PlotBase(BECWidget, QWidget):
|
|||||||
|
|
||||||
@legend_label_size.setter
|
@legend_label_size.setter
|
||||||
def legend_label_size(self, value: int):
|
def legend_label_size(self, value: int):
|
||||||
|
"""
|
||||||
|
The font size of the legend font.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(int): The font size to set.
|
||||||
|
"""
|
||||||
if not self.plot_item.legend:
|
if not self.plot_item.legend:
|
||||||
return
|
return
|
||||||
scale = (
|
scale = (
|
||||||
|
Reference in New Issue
Block a user