Skip to content

Commit

Permalink
fix: Option to not show, to enable saving of figure
Browse files Browse the repository at this point in the history
  • Loading branch information
iwishiwasaneagle committed Apr 4, 2023
1 parent d9c5bc0 commit 8c004df
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/jdrones/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def plot_states_over_time(df: pd.DataFrame, variables: list[STATE_ENUM], ax: plt


@validate_df_wrapper
def plot_standard(df: pd.DataFrame, figsize: tuple[float, float] = (12, 12)):
def plot_standard(
df: pd.DataFrame, figsize: tuple[float, float] = (12, 12), show: bool = True
):
"""
Plot the standard 2-by-2 layout
Expand All @@ -255,6 +257,10 @@ def plot_standard(df: pd.DataFrame, figsize: tuple[float, float] = (12, 12)):
figsize: float,float
Figure size
(Default = (12,12))
show : bool
If figure should be shown. Set to :code:`False` if you want to save the
figure using :code:`plt.gcf()`
(Default = :code:`True`)
"""
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(221, projection="3d")
Expand All @@ -270,4 +276,5 @@ def plot_standard(df: pd.DataFrame, figsize: tuple[float, float] = (12, 12)):
ax.legend()

fig.tight_layout()
plt.show()
if show:
plt.show()

0 comments on commit 8c004df

Please sign in to comment.