diff --git a/glue/core/data.py b/glue/core/data.py index a06297c22..178e43d4c 100644 --- a/glue/core/data.py +++ b/glue/core/data.py @@ -124,9 +124,10 @@ def coords(self): @coords.setter def coords(self, value): - self._coords = value - if len(self.components) > 0: - self._update_world_components(self.ndim) + if (hasattr(self, '_coords') and self._coords != value) or not hasattr(self, '_coords'): + self._coords = value + if len(self.components) > 0: + self._update_world_components(self.ndim) @property def subsets(self): diff --git a/glue/viewers/matplotlib/qt/tests/test_data_viewer.py b/glue/viewers/matplotlib/qt/tests/test_data_viewer.py index 55167d166..846776a97 100644 --- a/glue/viewers/matplotlib/qt/tests/test_data_viewer.py +++ b/glue/viewers/matplotlib/qt/tests/test_data_viewer.py @@ -534,6 +534,7 @@ def test_numerical_data_changed(self): self.viewer.add_data(self.data) assert self.draw_count == 1 data = Data() + data.coords = self.data.coords for cid in self.data.visible_components: data.add_component(self.data[cid] * 2, cid.label) self.data.update_values_from_data(data)