May-06-2018, 12:32 AM
My program is written in python 2.7, and I am not able to use matplotlib. It executes without any errors. But doesn't plot the pie chart
Matplotlib not working
|
May-06-2018, 12:32 AM
My program is written in python 2.7, and I am not able to use matplotlib. It executes without any errors. But doesn't plot the pie chart
May-06-2018, 10:07 AM
(This post was last modified: May-06-2018, 10:08 AM by Gribouillis.)
The basic matplotlib's pie chart demo works for me with python 2.7. Does it also work for you?
May-06-2018, 01:05 PM
Hi!
In matplotlib you need to select a backend (the real place where the plot is created) The typical backends are Gtk3, Qt5, Wx... If you do not specify one the default backend is 'Agg', designed to plot to a file and not to a window. So your script is creating the plot and, as you are using a file-only backend and there is no instruction to save to file just leaving silently. You need to select a graphical backend... some typical ones are 'GTK3Agg', 'Qt5Agg', 'TkAgg' (see the doc of matplotlib for the full list), but not all of them are normally installed, so try some of them or install the one you want) There are 3 basic ways to select the backend.
And remember, in general, if you use plt.show() you need a GUI backend, if you just use figure.saveas() it might be enough with the 'Agg' backend (that is always present) |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Matplotlib not working | svalencic | 4 | 987 |
Dec-18-2024, 11:10 AM Last Post: svalencic |
|
Matplotlib: How do I convert Dates from Excel to use in Matplotlib | JaneTan | 1 | 4,310 |
Mar-11-2021, 10:52 AM Last Post: buran |
|
hatching not working properly with matplotlib | Staph | 3 | 4,143 |
Jul-28-2019, 07:17 AM Last Post: ThomasL |