From 596a733b04de34aeec954b0b3ed0317d08d66cff Mon Sep 17 00:00:00 2001 From: Nathan Keim Date: Mon, 3 Jun 2024 16:46:15 -0400 Subject: [PATCH 1/3] MNT: Avoid passing argument to plt.gca() --- trackpy/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trackpy/plots.py b/trackpy/plots.py index 99fc68c0..e43d9169 100644 --- a/trackpy/plots.py +++ b/trackpy/plots.py @@ -80,7 +80,7 @@ def wrapper(*args, **kwargs): if kwargs.get('ax') is None: if not hasattr(plt.gca(), 'zaxis'): plt.figure() # initialize new Fig when current axis is not 3d - kwargs['ax'] = plt.gca(projection='3d') + kwargs['ax'] = plt.subplot(projection='3d') show_plot = True else: if not hasattr(plt.gca(), 'zaxis'): From 2d7c22983f3f2c5ae1a3995df635b16b5ac346ec Mon Sep 17 00:00:00 2001 From: Nathan Keim Date: Mon, 3 Jun 2024 16:53:49 -0400 Subject: [PATCH 2/3] DOC: Release note for #759 fix --- doc/releases/v0.6.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/v0.6.txt b/doc/releases/v0.6.txt index f28b3cc2..d751c468 100644 --- a/doc/releases/v0.6.txt +++ b/doc/releases/v0.6.txt @@ -6,6 +6,7 @@ trackpy v0.6.3 is a minor compatibility update for newer Pandas verisons. Dependencies ~~~~~~~~~~~~ - Improves support for latest Pandas in emsd function (@hz-xiaxz, #758) +- Fix deprecated matplotlib usage in 3D plotting (@jacopoabramo, #767) v0.6.2 From 10674d9b3b1698338e25f253e186272d05d593cd Mon Sep 17 00:00:00 2001 From: Nathan Keim Date: Fri, 7 Jun 2024 15:54:28 -0400 Subject: [PATCH 3/3] TST: Add smoke test for plot_traj3d --- trackpy/tests/test_plots.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trackpy/tests/test_plots.py b/trackpy/tests/test_plots.py index ea645938..7c8ec8a2 100644 --- a/trackpy/tests/test_plots.py +++ b/trackpy/tests/test_plots.py @@ -57,6 +57,12 @@ def test_ptraj_t_column(self): df.columns = cols plots.plot_traj(df, t_column='arbitrary name') + def test_ptraj3d(self): + sparse3d = self.sparse.copy() + sparse3d['z'] = 0 + # smoke test + plots.plot_traj3d(sparse3d) + def test_annotate(self): suppress_plotting() f = DataFrame({'x': [0, 1], 'y': [0, 1], 'frame': [0, 0],