From c2dd255e8a7d2fbdd4e50908cd7adffbae7c89a9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 21 Jan 2023 18:17:04 -0500 Subject: [PATCH] Only remove axis from scene when in one --- piker/ui/_pg_overrides.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/piker/ui/_pg_overrides.py b/piker/ui/_pg_overrides.py index b7c0b9aa..53ed5405 100644 --- a/piker/ui/_pg_overrides.py +++ b/piker/ui/_pg_overrides.py @@ -91,7 +91,7 @@ class PlotItem(pg.PlotItem): title=None, viewBox=None, axisItems=None, - default_axes=['left', 'bottom'], + default_axes=['right', 'bottom'], enableMenu=True, **kargs ): @@ -130,7 +130,7 @@ class PlotItem(pg.PlotItem): If the ``unlink: bool`` is set to ``False`` then the axis will stay linked to its view and will only be removed from the - layoutonly be removed from the layout. + layout. If no axis with ``name: str`` is found then this is a noop. @@ -144,7 +144,10 @@ class PlotItem(pg.PlotItem): axis = entry['item'] self.layout.removeItem(axis) - axis.scene().removeItem(axis) + scn = axis.scene() + if scn: + scn.removeItem(axis) + if unlink: axis.unlinkFromView()