From e84cfd81f6b5f77feb67068a2069d10d36cfaefb Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Thu, 2 Jul 2020 04:29:37 -0400 Subject: [PATCH 1/2] Add changelog for PR #278. --- changelog/278.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/278.bugfix.rst diff --git a/changelog/278.bugfix.rst b/changelog/278.bugfix.rst new file mode 100644 index 000000000..f9a739318 --- /dev/null +++ b/changelog/278.bugfix.rst @@ -0,0 +1 @@ +Fix NDCube plotting bug when dependent axes are not first axes. From e162eb546e42bab1b115011b658b54232d585e53 Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Thu, 2 Jul 2020 04:36:19 -0400 Subject: [PATCH 2/2] Fix plotting bug when dependent axes are not first axes. Redo of 6a03e6dc4260e753d241a6467e986988c31c4a3e --- ndcube/mixins/plotting.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ndcube/mixins/plotting.py b/ndcube/mixins/plotting.py index 2dea566ab..c0e2e7e6c 100644 --- a/ndcube/mixins/plotting.py +++ b/ndcube/mixins/plotting.py @@ -452,10 +452,10 @@ def _derive_axes_coordinates(self, axes_coordinates, axes_units, data_shape, edg axis_label_text = self.world_axis_physical_types[i] # If the shape of the data is not 1, or all the axes are not dependent if new_axis_coordinate.ndim != 1 and new_axis_coordinate.ndim != len(data_shape): - index = utils.wcs.get_dependent_data_axes(self.wcs, i, self.missing_axes) - reduce_axis = np.where(index == np.array([i]))[0] - - index = np.delete(index, reduce_axis) + dependent_axes = utils.wcs.get_dependent_data_axes(self.wcs, i, + self.missing_axes) + reduce_axis = np.where(dependent_axes == np.array([i]))[0] + index = np.delete(np.arange(len(dependent_axes)), reduce_axis) # Reduce the data by taking mean new_axis_coordinate = np.mean(new_axis_coordinate, axis=tuple(index))