RocketPy icon indicating copy to clipboard operation
RocketPy copied to clipboard

ENH: Allow saving plots instead of showing them

Open nalquas opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

All matplotlib plots generated by RocketPy (for example via Rocket.draw or flight.all_info) are shown using matplotlib's show function. This does not really allow for automatic export of these plots (as is the case when not using Jupyter Notebook).

Describe the solution you'd like

Add a parameter to the info functions (and other plot-generating functions) for selecting between immediately showing the plot and saving the plot to a file. Internally, this can be done using matplotlib's savefig function.

nalquas avatar Feb 27 '24 15:02 nalquas

Hello @nalquas , thank you for opening this issue, that's a wonderful feature request.

Please let us know if you would be interested in contributing to the solution.

Here are some suggestions that might help:

  • Hackathon 2022: https://github.com/RocketPy-Team/RocketPy-Hackathon-2022/pull/104/files#diff-2a21c44703e31fe4922b5045115a85bed731e90a3e622139125a74a4bcf120d9
  • Hackathon 2020 (private repo): https://github.com/RocketPy-Team/Hackathon_2020/pull/88/files

Overall, allowing the user to save the plots instead of just plotting them is quite helpful, specially to teams wanting to create reports for competitions submissions.

Gui-FernandesBR avatar Feb 27 '24 18:02 Gui-FernandesBR

Hi @Gui-FernandesBR, thank you for the response. I would be interested in working on this (I am part of a student team that needs this feature), although I see you self-assigned the issue in the meantime. Did you already start working on it?

nalquas avatar Apr 09 '24 15:04 nalquas

Hi @Gui-FernandesBR, thank you for the response. I would be interested in working on this (I am part of a student team that needs this feature), although I see you self-assigned the issue in the meantime. Did you already start working on it?

No I have not started. Feel free to implement it by yourself, asking any questions if needed. We would be extremely glad receiving a PR from you.

Gui-FernandesBR avatar Apr 09 '24 17:04 Gui-FernandesBR