[Matplotlib-users] Use of Pyplot in a GUI script

Paul Hobson pmhobson at gmail.com
Mon May 16 14:35:09 EDT 2016

This example for a app using WebAgg, but it doesn't use any pyplot

The main thing to remember is that you:
1) Create a figure (matplotlib.figure.Figure)
2) Use the figure object's method of add the axes (e.g., fig.add_subplot)
3) use methods attached to the axes to do everything else


On Tue, Apr 26, 2016 at 2:28 PM, Eric <eric.shain at gmail.com> wrote:

> I've read that when writing a GUI application to avoid using pyplot. I
> experienced this when I wrote a python script that called the tkinter file
> dialog and then processed and plotted data. It would run when launched in
> Ipython but would crash when run in the terminal. It ran in terminal when I
> eliminated the file dialog and the file dialog code ran without the
> plotting. I rewrote the script using pyqt4, and avoided using pyplot using
> matplotlib figure instead. First question is is it true that I should avoid
> any use of pyplot in a gui app? Second is that I find it hard to do things
> in matplotlib that are easy in pyplot like drawing horizontal or vertical
> lines and such. Is there documentation and code examples using the
> matplotlib without pyplot?
> Thanks, Eric
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Use-of-Pyplot-in-a-GUI-script-tp47030.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160516/7b23bd1b/attachment-0001.html>

More information about the Matplotlib-users mailing list