Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/278.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix NDCube plotting bug when dependent axes are not first axes.
8 changes: 4 additions & 4 deletions ndcube/mixins/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down