diff --git a/CHANGELOG.md b/CHANGELOG.md index 00d4e6708..863077840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - +- ENH: Optional argument to show the plot in Function.compare_plots [#563](https://github.com/RocketPy-Team/RocketPy/pull/563) ### Fixed - BUG: export_eng 'Motor' method would not work for liquid motors. [#559](https://github.com/RocketPy-Team/RocketPy/pull/559) diff --git a/rocketpy/mathutils/function.py b/rocketpy/mathutils/function.py index e8b6a9318..d032d40b3 100644 --- a/rocketpy/mathutils/function.py +++ b/rocketpy/mathutils/function.py @@ -1474,6 +1474,7 @@ def compare_plots( force_data=False, force_points=False, return_object=False, + show=True, ): """Plots N 1-Dimensional Functions in the same plot, from a lower limit to an upper limit, by sampling the Functions several times in @@ -1513,6 +1514,8 @@ def compare_plots( Setting force_points to True will plot all points, as a scatter, in which the Function was evaluated to plot it. Default value is False. + show : bool, optional + If True, shows the plot. Default value is True. Returns ------- @@ -1586,7 +1589,8 @@ def compare_plots( plt.xlabel(xlabel) plt.ylabel(ylabel) - plt.show() + if show: + plt.show() if return_object: return fig, ax