Skip to content

Commit

Permalink
Fix plot viewer so that it doesn't reset zoom on replot
Browse files Browse the repository at this point in the history
  • Loading branch information
ejeschke committed Oct 5, 2024
1 parent 6b07169 commit 508ea40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ginga/gw/PlotView.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,15 @@ def set_dataobj(self, dataobj):
if old_dataobj is not None:
self.make_callback('image-unset', old_dataobj)
self._dataobj = dataobj

self.clear()

if isinstance(dataobj, AstroImage):
dataobj.add_callback('modified', self.show_image)
dataobj.add_callback('modified', lambda dataobj: self.replot())
self.show_image(dataobj)

elif isinstance(dataobj, Plotable):
dataobj.add_callback('modified', self.show_plotable)
dataobj.add_callback('modified', lambda dataobj: self.replot())
self.show_plotable(dataobj)

self.zoom_fit()
Expand Down
1 change: 1 addition & 0 deletions ginga/plot/Plotable.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def set_grid(self, tf):
self.grid = tf

def clear(self):
self.canvas.delete_all_objects()
self.titles.x_axis = None
self.titles.y_axis = None
self.titles.title = None
Expand Down

0 comments on commit 508ea40

Please sign in to comment.