diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py index aa037c523872df65049eaa9610eedab8d07424d4..5f0dbb66e7f59a9f573ef5b4a0e3940e6017f602 100644 --- a/src/robofish/io/file.py +++ b/src/robofish/io/file.py @@ -687,6 +687,7 @@ class File(h5py.File): cmap="Set1", skip_timesteps=0, max_timesteps=None, + show=False, ): """Plot the file using matplotlib.pyplot @@ -701,6 +702,7 @@ class File(h5py.File): cmap (matplotlib.colors.Colormap, optional): The colormap to use skip_timesteps (int, optional): Skip timesteps in the begining of the file max_timesteps (int, optional): Cut of timesteps in the end of the file. + show (bool, optional): Show the created plot. Returns: matplotlib.axes: The axes object with the plot. """ @@ -784,6 +786,10 @@ class File(h5py.File): ax.legend(loc="lower right") ax.set_xlabel("x [cm]") ax.set_ylabel("y [cm]") + + if show: + plt.show() + return ax def render(self, video_path=None, **kwargs):