From ebe045157060ba52cfd332ebee463515a9978228 Mon Sep 17 00:00:00 2001 From: FloraSauerbronn <130789651+FloraSauerbronn@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:57:24 -0300 Subject: [PATCH] Update gliderpy/plotting.py Co-authored-by: Filipe --- gliderpy/plotting.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gliderpy/plotting.py b/gliderpy/plotting.py index 0bbfdc4..ed84671 100644 --- a/gliderpy/plotting.py +++ b/gliderpy/plotting.py @@ -57,10 +57,14 @@ def plot_transect( """ cmap = kw.get("cmap", None) - if ax is None: + fignums = plt.get_fignums() + if ax is None and not fignums: fig, ax = plt.subplots(figsize=(17, 2)) + elif ax: + fig = ax.get_figure() else: - fig = ax.figure + ax = plt.gca() + fig = plt.gcf() cs = ax.scatter( df.index,