Skip to content

Commit 0967ea0

Browse files
committed
fix bug when remove_graphic() is used (#405)
1 parent 6966097 commit 0967ea0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fastplotlib/layouts/_plot_area.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ def add_graphic(self, graphic: Graphic, center: bool = True):
373373
Center the camera on the newly added Graphic
374374
375375
"""
376+
377+
if graphic in self:
378+
# graphic is already in this plot but was removed from the scene, add it back
379+
self.scene.add(graphic.world_object)
380+
return
381+
376382
self._add_or_insert_graphic(graphic=graphic, center=center, action="add")
377383

378384
graphic.position_z = len(self)

0 commit comments

Comments
 (0)