Repository: scipp/plopp

Issue:
Aspect argument (and maybe others?) not forwarded to `tiled`
```Py
import plopp as pp

a = pp.data.data2d()

pp.plot(a, aspect='equal') + pp.plot(a)
```
![Screenshot at 2024-05-08 22-22-30](https://github.com/scipp/plopp/assets/39047984/f76937d5-93e6-47fa-9283-ca724269639e)


Discussion:

Patch:
diff --git a/src/plopp/backends/matplotlib/canvas.py b/src/plopp/backends/matplotlib/canvas.py
index 675198e..a57286c 100644
--- a/src/plopp/backends/matplotlib/canvas.py
+++ b/src/plopp/backends/matplotlib/canvas.py
@@ -73,7 +73,7 @@ class Canvas:
         grid: bool = False,
         user_vmin: sc.Variable | float = None,
         user_vmax: sc.Variable | float = None,
-        aspect: Literal['auto', 'equal'] = 'auto',
+        aspect: Literal['auto', 'equal', None] = None,
         cbar: bool = False,
         legend: bool | tuple[float, float] = True,
         **ignored,
@@ -100,9 +100,10 @@ class Canvas:
         if self.ax is None:
             self.fig = make_figure(figsize=(6.0, 4.0) if figsize is None else figsize)
             self.ax = self.fig.add_subplot()
-            self.ax.set_aspect(aspect)
         else:
             self.fig = self.ax.get_figure()
+        if aspect is not None:
+            self.ax.set_aspect(aspect)
         if self.is_widget():
             self.fig.canvas.toolbar_visible = False
             self.fig.canvas.header_visible = False
diff --git a/src/plopp/backends/matplotlib/tiled.py b/src/plopp/backends/matplotlib/tiled.py
index b4ef333..75d8826 100644
--- a/src/plopp/backends/matplotlib/tiled.py
+++ b/src/plopp/backends/matplotlib/tiled.py
@@ -82,7 +82,6 @@ class Tiled:
         )
 
         self.gs = gridspec.GridSpec(nrows, ncols, figure=self.fig, **kwargs)
-        self.axes = []
         self.figures = np.full((nrows, ncols), None)
         self._history = []
 
@@ -109,7 +108,7 @@ class Tiled:
         else:
             out = {'text/plain': f'TiledFigure(nrows={self.nrows}, ncols={self.ncols})'}
             npoints = sum(
-                len(line.get_xdata()) for ax in self.axes for line in ax.lines
+                len(line.get_xdata()) for ax in self.fig.get_axes() for line in ax.lines
             )
             out.update(get_repr_maker(npoints=npoints)(self.fig))
             return out
diff --git a/src/plopp/graphics/graphicalview.py b/src/plopp/graphics/graphicalview.py
index 0bbea7f..af203c7 100644
--- a/src/plopp/graphics/graphicalview.py
+++ b/src/plopp/graphics/graphicalview.py
@@ -45,7 +45,7 @@ class GraphicalView(View):
         vmin: sc.Variable | float | None = None,
         vmax: sc.Variable | float | None = None,
         scale: dict[str, str] | None = None,
-        aspect: Literal['auto', 'equal'] = 'auto',
+        aspect: Literal['auto', 'equal', None] = None,
         grid: bool = False,
         title: str | None = None,
         figsize: tuple[float, float] | None = None,
diff --git a/src/plopp/plotting/plot.py b/src/plopp/plotting/plot.py
index cb68dee..c146464 100644
--- a/src/plopp/plotting/plot.py
+++ b/src/plopp/plotting/plot.py
@@ -14,7 +14,7 @@ from .common import input_to_nodes, preprocess, raise_multiple_inputs_for_2d_plo
 def plot(
     obj: PlottableMulti,
     *,
-    aspect: Literal['auto', 'equal'] = 'auto',
+    aspect: Literal['auto', 'equal', None] = None,
     cbar: bool = True,
     coords: list[str] | None = None,
     errorbars: bool = True,


Test patch:
diff --git a/tests/backends/matplotlib/mpl_tiled_test.py b/tests/backends/matplotlib/mpl_tiled_test.py
index 6769e3a..17c23ec 100644
--- a/tests/backends/matplotlib/mpl_tiled_test.py
+++ b/tests/backends/matplotlib/mpl_tiled_test.py
@@ -225,3 +225,12 @@ def test_tiled_keeps_figure_props():
     assert tiled[0, 0].canvas.yscale == 'log'
     assert tiled[0, 1].canvas.xscale == 'log'
     assert tiled[0, 1].canvas.yscale == 'linear'
+
+
+def test_tiled_keeps_aspect():
+    a = data_array(ndim=2)
+    f1 = a.plot(aspect='equal')
+    f2 = a.plot(cbar=False)
+    tiled = f1 + f2
+    assert tiled.fig.get_axes()[0].get_aspect() == 1.0
+    assert tiled.fig.get_axes()[2].get_aspect() == "auto"