JelteF / PyLaTeX

A Python library for creating LaTeX files
https://jeltef.github.io/PyLaTeX/
MIT License
2.24k stars 287 forks source link

support Figure.add_plot with a figure handle #345

Open headtr1ck opened 2 years ago

headtr1ck commented 2 years ago

As far as I can tell it is only possible to add custom figure files or the current active pyplot figure. I would like to add a plot of a given matplotlib.figure.Figure object.

Currently we have the workaround by calling plt.figure(fig.number) to make fig the active figure before adding the plot.

Would it be possible to add an optional figure argument to "add_plot" (None=>active figure)?

JelteF commented 2 years ago

Feel free to make a PR.

On Fri, 11 Feb 2022, 12:59 Mick, @.***> wrote:

As far as I can tell it is only possible to add custom figure files or the current active pyplot figure. I would like to add a plot of a given matplotlib.figure.Figure object.

Currently we have the workaround by calling plt.figure(fig.number) to make fig the active figure before adding the plot.

Would it be possible to add an optional figure argument to "add_plot" (None=>active figure)?

— Reply to this email directly, view it on GitHub https://github.com/JelteF/PyLaTeX/issues/345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3YJQCOUIOQ56QG2Z335DU2T22NANCNFSM5OEBVR6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>