From ebacaff0794c5fae904aacb4405bc44ebf49be42 Mon Sep 17 00:00:00 2001
From: DanRyanIrish <ryand5@tcd.ie>
Date: Tue, 20 Dec 2022 08:58:50 +0000
Subject: [PATCH] Backport PR #578: Pass `data_unit` kwarg through when
 visualizing > two dimensions

---
 changelog/578.bugfix.rst            | 2 ++
 ndcube/visualization/mpl_plotter.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 changelog/578.bugfix.rst

diff --git a/changelog/578.bugfix.rst b/changelog/578.bugfix.rst
new file mode 100644
index 000000000..a6276b630
--- /dev/null
+++ b/changelog/578.bugfix.rst
@@ -0,0 +1,2 @@
+Fix a bug where ``data_unit`` was not being correctly passed through to the underlying plotting
+function when animating a cube.
diff --git a/ndcube/visualization/mpl_plotter.py b/ndcube/visualization/mpl_plotter.py
index 940e4f6e1..4916d1974 100644
--- a/ndcube/visualization/mpl_plotter.py
+++ b/ndcube/visualization/mpl_plotter.py
@@ -86,7 +86,7 @@ def plot(self, axes=None, plot_axes=None, axes_coordinates=None,
             else:
                 ax = self._animate_cube(plot_wcs, plot_axes=plot_axes,
                                         axes_coordinates=axes_coordinates,
-                                        axes_units=axes_units, **kwargs)
+                                        axes_units=axes_units, data_unit=data_unit, **kwargs)
 
         return ax