From f79796a72ae599877413714244548ffb7db0e3e1 Mon Sep 17 00:00:00 2001 From: kushalkolar Date: Mon, 19 Feb 2024 05:37:44 -0500 Subject: [PATCH] fix bug when remove_graphic() is used --- fastplotlib/layouts/_plot_area.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fastplotlib/layouts/_plot_area.py b/fastplotlib/layouts/_plot_area.py index 9522832d3..819efa205 100644 --- a/fastplotlib/layouts/_plot_area.py +++ b/fastplotlib/layouts/_plot_area.py @@ -373,6 +373,12 @@ def add_graphic(self, graphic: Graphic, center: bool = True): Center the camera on the newly added Graphic """ + + if graphic in self: + # graphic is already in this plot but was removed from the scene, add it back + self.scene.add(graphic.world_object) + return + self._add_or_insert_graphic(graphic=graphic, center=center, action="add") graphic.position_z = len(self)