bec_widgets.widgets.plots.plot_base =================================== .. py:module:: bec_widgets.widgets.plots.plot_base Classes ------- .. autoapisummary:: bec_widgets.widgets.plots.plot_base.BECViewBox bec_widgets.widgets.plots.plot_base.PlotBase bec_widgets.widgets.plots.plot_base.UIMode Module Contents --------------- .. py:class:: BECViewBox(parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False, enableMenu=True, name=None, invertX=False, defaultPadding=0.02) Bases: :py:obj:`pyqtgraph.ViewBox` **Bases:** :class:`GraphicsWidget ` Box that allows internal scaling/panning of children by mouse drag. This class is usually created automatically as part of a :class:`PlotItem ` or :ref:`Canvas ` or with :func:`GraphicsLayout.addViewBox() `. Features: * Scaling contents by mouse or auto-scale when contents change * View linking--multiple views display the same data ranges * Configurable by context menu * Item coordinate mapping methods ================= ============================================================= **Arguments:** *parent* (QGraphicsWidget) Optional parent widget *border* (QPen) Do draw a border around the view, give any single argument accepted by :func:`mkPen ` *lockAspect* (False or float) The aspect ratio to lock the view coorinates to. (or False to allow the ratio to change) *enableMouse* (bool) Whether mouse can be used to scale/pan the view *invertY* (bool) See :func:`invertY ` *invertX* (bool) See :func:`invertX ` *enableMenu* (bool) Whether to display a context menu when right-clicking on the ViewBox background. *name* (str) Used to register this ViewBox so that it appears in the "Link axis" dropdown inside other ViewBox context menus. This allows the user to manually link the axes of any other view to this one. *defaultPadding* (float) fraction of the data range that will be added as padding by default ================= ============================================================= .. py:method:: itemBoundsChanged(item) .. py:method:: paint(painter, opt, widget) .. py:attribute:: sigPaint .. py:class:: PlotBase(parent: qtpy.QtWidgets.QWidget | None = None, config: bec_widgets.utils.ConnectionConfig | None = None, client=None, gui_id: str | None = None, popups: bool = True, **kwargs) Bases: :py:obj:`bec_widgets.utils.bec_widget.BECWidget`, :py:obj:`qtpy.QtWidgets.QWidget` Mixin class for all BEC widgets, to handle cleanup Base class for all BEC widgets. This class should be used as a mixin class for all BEC widgets, e.g.: >>> class MyWidget(BECWidget, QWidget): >>> def __init__(self, parent=None, client=None, config=None, gui_id=None): >>> super().__init__(parent=parent, client=client, config=config, gui_id=gui_id) :param client: The BEC client. :type client: BECClient, optional :param config: The connection configuration. :type config: ConnectionConfig, optional :param gui_id: The GUI ID. :type gui_id: str, optional :param theme_update: Whether to subscribe to theme updates. Defaults to False. When set to True, the widget's apply_theme method will be called when the theme changes. :type theme_update: bool, optional .. py:method:: _apply_autorange_only_visible_curves() Apply autorange to the plot item based on the provided curves. :param curves: List of curves to apply autorange to. :type curves: list .. py:method:: _apply_x_label() Actually updates the pyqtgraph axis label text to the combined label. Called whenever user label or suffix changes. .. py:method:: _apply_y_label() Actually updates the pyqtgraph y axis label text to the combined y label. Called whenever y label or suffix changes. .. py:method:: _init_toolbar() .. py:method:: _init_ui() .. py:method:: _tuple_to_qpointf(tuple: PlotBase._tuple_to_qpointf.tuple | list) Helper function to convert a tuple to a QPointF. :param tuple: Tuple or list of two numbers. :type tuple: tuple|list :returns: The tuple converted to a QPointF. :rtype: QPointF .. py:method:: add_side_menus() Adds multiple menus to the side panel. .. py:method:: apply_theme(theme: str) Apply the theme to the widget. :param theme: The theme to be applied. :type theme: str, optional .. py:method:: auto_range(value: bool = True) On demand apply autorange to the plot item based on the visible curves. :param value: If True, apply autorange to the visible curves. :type value: bool .. py:method:: auto_range_x() -> bool Set auto range for the x-axis. .. py:method:: auto_range_y() -> bool Set auto range for the y-axis. .. py:method:: cleanup() Cleanup the widget. .. py:method:: cleanup_pyqtgraph(item: pyqtgraph.PlotItem | None = None) Cleanup pyqtgraph items. .. py:method:: enable_fps_monitor() -> bool Enable the FPS monitor. .. py:method:: enable_popups() Enable popups setting dialogs for the plot widget. .. py:method:: enable_side_panel() -> bool Show Side Panel .. py:method:: enable_toolbar() -> bool Show Toolbar. .. py:method:: hook_crosshair() -> None Hook the crosshair to all plots. .. py:method:: hook_fps_monitor() Hook the FPS monitor to the plot. .. py:method:: inner_axes() -> bool Show inner axes of the plot widget. .. py:method:: invert_x() -> bool Invert X axis. .. py:method:: invert_y() -> bool Invert Y axis. .. py:method:: legend_label_size() -> int The font size of the legend font. .. py:method:: lock_aspect_ratio() -> bool Lock aspect ratio of the plot widget. .. py:method:: minimal_crosshair_precision() -> int Minimum decimal places for crosshair when dynamic precision is enabled. .. py:method:: outer_axes() -> bool Show the outer axes of the plot widget. .. py:method:: reset() -> None Reset the plot widget. .. py:method:: reset_legend() In the case that the legend is not visible, reset it to be visible to top left corner .. py:method:: set(**kwargs) Set the properties of the plot widget. :param \*\*kwargs: Keyword arguments for the properties to be set. Possible properties: - title: str - x_label: str - y_label: str - x_scale: Literal["linear", "log"] - y_scale: Literal["linear", "log"] - x_lim: tuple - y_lim: tuple - legend_label_size: int .. py:method:: set_x_label_suffix(suffix: str) Public or protected method to update the suffix. The user code or subclass (Waveform) can call this when x_mode changes, but the AxisSettings won't show it. .. py:method:: set_y_label_suffix(suffix: str) Public method to update the y label suffix. .. py:method:: title() -> str Set title of the plot. .. py:method:: toggle_crosshair() -> None Toggle the crosshair on all plots. .. py:method:: unhook_crosshair() -> None Unhook the crosshair from all plots. .. py:method:: unhook_fps_monitor(delete_label=True) Unhook the FPS monitor from the plot. .. py:method:: update_fps_label(fps: float) -> None Update the FPS label. :param fps: The frames per second. :type fps: float .. py:method:: viewbox_state_changed() Emit a signal when the state of the viewbox has changed. Merges the default pyqtgraphs signal states and also CTRL menu toggles. .. py:method:: x_grid() -> bool Show grid on the x-axis. .. py:method:: x_label() -> str The set label for the x-axis. .. py:method:: x_limits() -> qtpy.QtCore.QPointF Get the x limits of the plot. .. py:method:: x_log() -> bool Set X-axis to log scale if True, linear if False. .. py:method:: y_grid() -> bool Show grid on the y-axis. .. py:method:: y_label() -> str The set label for the y-axis. .. py:method:: y_limits() -> qtpy.QtCore.QPointF Get the y limits of the plot. .. py:method:: y_log() -> bool Set Y-axis to log scale if True, linear if False. .. py:attribute:: BASE_USER_ACCESS :value: ['enable_toolbar', 'enable_toolbar.setter', 'enable_side_panel', 'enable_side_panel.setter',... .. py:attribute:: PLUGIN :value: False .. py:attribute:: RPC :value: False .. py:attribute:: USER_ACCESS :value: ['remove', 'attach', 'detach', 'enable_toolbar', 'enable_toolbar.setter', 'enable_side_panel',... .. py:attribute:: arrow_item .. py:attribute:: axis_settings_dialog :value: None .. py:attribute:: crosshair :value: None .. py:attribute:: crosshair_coordinates_changed .. py:attribute:: crosshair_coordinates_clicked .. py:attribute:: crosshair_position_changed .. py:attribute:: crosshair_position_clicked .. py:attribute:: entry_validator .. py:attribute:: fps_label .. py:attribute:: fps_monitor :value: None .. py:attribute:: layout .. py:attribute:: layout_manager .. py:attribute:: plot_item .. py:attribute:: plot_widget .. py:attribute:: property_changed .. py:attribute:: side_panel .. py:attribute:: state_manager .. py:attribute:: tick_item .. py:attribute:: toolbar .. py:property:: ui_mode :type: UIMode Get the UI mode. .. py:property:: visible_items .. py:property:: x_label_combined :type: str The final label shown on the axis = user portion + suffix + [units]. .. py:property:: x_label_suffix :type: str A read-only (or internal) suffix automatically appended to the user label. Not settable by the user directly from the UI. .. py:property:: x_label_units :type: str The units of the x-axis. .. py:property:: x_lim :type: tuple Get the x limits of the plot. .. py:property:: x_max :type: float Get the maximum x limit of the plot. .. py:property:: x_min :type: float Get the minimum x limit of the plot. .. py:property:: y_label_combined :type: str The final y label shown on the axis = user portion + suffix + [units]. .. py:property:: y_label_suffix :type: str A read-only suffix automatically appended to the y label. .. py:property:: y_label_units :type: str The units of the y-axis. .. py:property:: y_lim :type: tuple Get the y limits of the plot. .. py:property:: y_max :type: float Get the maximum y limit of the plot. .. py:property:: y_min :type: float Get the minimum y limit of the plot. .. py:class:: UIMode(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access:: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: NONE :value: 0 .. py:attribute:: POPUP :value: 1 .. py:attribute:: SIDE :value: 2