From 5b59ef28d6ca9ebc13facb837d2253e61d042210 Mon Sep 17 00:00:00 2001 From: Johannes Kasimir Date: Thu, 29 Jan 2026 14:52:31 +0100 Subject: [PATCH 1/6] test: check that axis names are correct --- tests/plotting/scatter_test.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index 33996c26..5a8b6eb1 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -37,6 +37,35 @@ def test_scatter_two_inputs(): pp.scatter({'a': a, 'b': b}) +def test_scatter_multi_input_ylabel_drops_name(): + a = pp.data.scatter() + b = pp.data.scatter(seed=2) * 10.0 + b.coords['x'] += sc.scalar(50.0, unit='m') + + fig = pp.scatter({'a': a, 'b': b}) + assert fig.canvas.ylabel == '[K]' + + +def test_scatter_multi_input_non_xy_dims_ylabel_drops_name(): + a = sc.DataArray( + data=sc.linspace('point', 0.0, 4.0, 5, unit='K'), + coords={ + 'u': sc.linspace('point', 0.0, 4.0, 5, unit='m'), + 'v': sc.linspace('point', -2.0, 2.0, 5, unit='m'), + }, + ) + b = sc.DataArray( + data=sc.linspace('point', 1.0, 5.0, 5, unit='K'), + coords={ + 'u': sc.linspace('point', 10.0, 14.0, 5, unit='m'), + 'v': sc.linspace('point', -2.0, 2.0, 5, unit='m'), + }, + ) + + fig = pp.scatter({'a': a, 'b': b}, x='u', y='v') + assert fig.canvas.ylabel == '[K]' + + def test_scatter_two_inputs_color(): a = scatter_data() b = scatter_data(seed=2) * 10.0 From 7ad97b350d674b4f14de875115cf6ee2e2112c2f Mon Sep 17 00:00:00 2001 From: Johannes Kasimir Date: Fri, 30 Jan 2026 15:19:25 +0100 Subject: [PATCH 2/6] fix tests --- tests/plotting/scatter_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index 5a8b6eb1..bd12f53d 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -43,7 +43,7 @@ def test_scatter_multi_input_ylabel_drops_name(): b.coords['x'] += sc.scalar(50.0, unit='m') fig = pp.scatter({'a': a, 'b': b}) - assert fig.canvas.ylabel == '[K]' + assert fig.canvas.ylabel == 'y [m]' def test_scatter_multi_input_non_xy_dims_ylabel_drops_name(): @@ -63,7 +63,7 @@ def test_scatter_multi_input_non_xy_dims_ylabel_drops_name(): ) fig = pp.scatter({'a': a, 'b': b}, x='u', y='v') - assert fig.canvas.ylabel == '[K]' + assert fig.canvas.ylabel == 'v [m]' def test_scatter_two_inputs_color(): From 5217ec5b330c8aa3a5198a0484d0f6b555901364 Mon Sep 17 00:00:00 2001 From: jokasimr Date: Fri, 30 Jan 2026 16:50:41 +0100 Subject: [PATCH 3/6] Update tests/plotting/scatter_test.py Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com> --- tests/plotting/scatter_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index bd12f53d..a81591ff 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -37,7 +37,7 @@ def test_scatter_two_inputs(): pp.scatter({'a': a, 'b': b}) -def test_scatter_multi_input_ylabel_drops_name(): +def test_scatter_multi_input_has_correct_axes_labels(): a = pp.data.scatter() b = pp.data.scatter(seed=2) * 10.0 b.coords['x'] += sc.scalar(50.0, unit='m') From 4067ba6b4540244652b39a3e05d95fcc0cb1ae90 Mon Sep 17 00:00:00 2001 From: jokasimr Date: Fri, 30 Jan 2026 16:50:51 +0100 Subject: [PATCH 4/6] Update tests/plotting/scatter_test.py Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com> --- tests/plotting/scatter_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index a81591ff..963c1b3e 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -43,6 +43,7 @@ def test_scatter_multi_input_has_correct_axes_labels(): b.coords['x'] += sc.scalar(50.0, unit='m') fig = pp.scatter({'a': a, 'b': b}) + assert fig.canvas.xlabel == 'x [m]' assert fig.canvas.ylabel == 'y [m]' From 83c7c9e1829273e221dca874bd885b2a1542c275 Mon Sep 17 00:00:00 2001 From: jokasimr Date: Fri, 30 Jan 2026 16:51:01 +0100 Subject: [PATCH 5/6] Update tests/plotting/scatter_test.py Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com> --- tests/plotting/scatter_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index 963c1b3e..c1cd0a3b 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -47,7 +47,7 @@ def test_scatter_multi_input_has_correct_axes_labels(): assert fig.canvas.ylabel == 'y [m]' -def test_scatter_multi_input_non_xy_dims_ylabel_drops_name(): +def test_scatter_multi_input_non_xy_dims_has_correct_axes_labels(): a = sc.DataArray( data=sc.linspace('point', 0.0, 4.0, 5, unit='K'), coords={ From 56471e38968ef5fead187bc1e14987a425a497b4 Mon Sep 17 00:00:00 2001 From: jokasimr Date: Fri, 30 Jan 2026 16:51:16 +0100 Subject: [PATCH 6/6] Update tests/plotting/scatter_test.py Co-authored-by: Neil Vaytet <39047984+nvaytet@users.noreply.github.com> --- tests/plotting/scatter_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/plotting/scatter_test.py b/tests/plotting/scatter_test.py index c1cd0a3b..031abb95 100644 --- a/tests/plotting/scatter_test.py +++ b/tests/plotting/scatter_test.py @@ -64,6 +64,7 @@ def test_scatter_multi_input_non_xy_dims_has_correct_axes_labels(): ) fig = pp.scatter({'a': a, 'b': b}, x='u', y='v') + assert fig.canvas.xlabel == 'u [m]' assert fig.canvas.ylabel == 'v [m]'