Error message in python plot using skfuzzy package - python

I am running "Fuzzy Control Systems: The Tipping Problem" posted here as an example.It works fine but displays following error message in plots. I need your help to fix this. I searched everywhere without any success.
C:\Users\Home\anaconda3\lib\site-packages\skfuzzy\control\fuzzyvariable.py:122: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
fig.show()

Related

Matplotlib does not show plot in PyCharm on Mac

I am using PyCharm on my MacBook to code and now I wanted to make a simple plot. When I run the file via the usual 'Run' command (do not know what it is called), it nicely shows my plots, but when I run the file in the Python console (which I find more convenient because you can access your variables) it does not show anything. On the other hand, when I just type it in the Python console afterwards, it does work.
I have read some things about backends and other 'solutions' as I am apparently not the only one with this issue. Mine says macosx and gives the command: "Backend MacOSX is interactive backend. Turning interactive mode on." after running the file in the Python console. I tried changing the backend:
import matplotlib
# matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
but that does not work (no plot pops up). And yes, I use plt.show() after my plotting section :)
I also tried with 'QtAgg' but then I get: "ImportError: Failed to import any qt binding"
Now I am completely new to this backends stuff (I think it has to do with this), so I could really use some clear directions on how I can solve this issue.
Thanks in advance!
I am not sure we can solve this bug with some adjustment. I think you need to fresh start. I suggest you to start a new clean venv and install a new matplotlib there.

Matplotlib cannot switch backend to 'TkAgg', as 'qt' is currently running

I am trying to display a plot in Pycharm Comunity Edition and I get the following error:
UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so >cannot show the figure.
I have installed and imported tkinter before importing matplotlib but I cannot make Matplotlib switch to 'TKAgg'.
I tried running
matplotlib.use('TKAgg', force=True)
and
plt.switch_backend('tkagg')
and they both result in the following error:
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive >framework, as 'qt' is currently running
I also tried adding MPLBACKEND=TkAgg to the environment variables but did not change anything.
Does anyone have an idea what else I can do to solve this so that I can display graphs?
I had the same issue, and I somehow got it to work by putting the
matplotlib.use("TkAgg")
statement at the end of my module imports.
Essentially, the call to TkAgg was the last thing prior to the code. Not sure how it worked, but it worked for me. I think another module I was originally importing after the TkAgg statement was the issue.
I have tried putting the TkAgg statement back early in the module imports, and the issue comes back. When it is the last thing listed before my code starts, it works fine.

sudden Qt error when using matplotlib on cmd

There are questions referring to this same error message, but the crucial difference is that I am not (deliberately) using Qt. I don't actually know what it is, and I am trying to run my program on cmd, not through any IDE. I have been using matplotlib without any problems until just now, when i suddenly got the error message:
This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".
Available platform plugins are: direct2d, minimal, offscreen, windows.
Reinstalling the application may fix this problem.
here is a sample program which produces this error, although I suspect it is a consequence of the package being used, not the program
import matplotlib.pyplot as plt
nums = [1,2,3,4]
labels = ["one","two","three","four"]
colours, one, two = plt.pie(nums, labels=labels, autopct='%1.1f%%')
plt.legend(colours, labels, loc="best")
plt.axis('equal')
plt.show()
again, I installed matplotlib years ago, and have been using it just fine until now. Any help would be greatly appreciated.
edit: python version 3.7.1, matplotlib version 3.1.1
Ok, I just fixed it by upgrading matplotlib to version 3.2.1
not sure why that worked but hey

Python, Spyder IDE - matplotlib does not plot

I'm using:
Python 2.7.3
matplotlib 1.4.1
Spyder IDE 2.3.8
My code has to produce a chart (combination of bar and scatter) . First run on the code succeeds in that, however all following executions (both run or debug) produce just an empty chart with correct grid, label, and legend, but no bars not scatter plot. I have to close Python console and open a new one to get the correct plot, and then the story repeats. In debugger I can see that all the data for the chart is fine.
I also tried Wing IDE (ver 5.1.10-1), and the very same code works fine all the time.
I found some suggestions about setting console preferences in Spyder (ie set GUI backend to Qt4Agg, agg, TkAgg, MAcOSX, Inline and such - none of those had any effect)
I would appreciate any help with this, as I'd prefer to use Spyder.
Many thanks
P.S. I used an earlier version of matplotlib without any issues, but recently I had to update it to ver 1.4.1 to use some libraries in an unrelated software project.

Python - networkx.read_pajek not working

I am working with python networkx and matplotlib.pyplot.
The code I am using is the following:
import networkx as net
import matplotlib.pyplot as plot
orgchart = net.read_pajek("ACME_orgchart.net")
net.draw(orgchart)
The code does not throw errors and runs fine but the graph that is supposed to appear, does not and I know the code runs fine because an icon appears in the dock which I am sure signifies the graph visualization software in python but the actual visualization does not appear . This code is from the book "Social network analysis for startups" if someone could please help me figure this problem out I would be really grateful.
I am using python 2.7.3, on mac osX, with networkx, matplotlib, numpy installed.
The problem was that my matplotlib was not being used in interactive mode. Hence when working with an interactive display I needed to also include the line: plot.show() at the end for the display to appear.
Further Information can be found at : http://networkx.lanl.gov/tutorial/tutorial.html

Categories

Resources