Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new ax feature #109

Closed
wants to merge 8 commits into from
7 changes: 6 additions & 1 deletion gliderpy/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def plot_track(df: pd.DataFrame) -> tuple(plt.Figure, plt.Axes):
def plot_transect(
df: pd.DataFrame,
var: str,
ax: plt.Axes = None,
**kw: dict,
) -> tuple(plt.Figure, plt.Axes):
"""Make a scatter plot of depth vs time coloured by a user defined
Expand All @@ -56,7 +57,11 @@ def plot_transect(
"""
cmap = kw.get("cmap", None)

fig, ax = plt.subplots(figsize=(17, 2))
if ax is None:
fig, ax = plt.subplots(figsize=(17, 2))
else:
fig = ax.figure
FloraSauerbronn marked this conversation as resolved.
Show resolved Hide resolved

cs = ax.scatter(
df.index,
df["pressure"],
Expand Down