simpful icon indicating copy to clipboard operation
simpful copied to clipboard

Plotting does not work

Open ZA0068 opened this issue 2 years ago • 5 comments

I tried to plot your built in plotting tools but it does not work because it says matplotlib does not exist.

Here is my error code:

Traceback (most recent call last):
  File "c:\Users\zaina\OneDrive\Skoleopgaver\Robotteknologi\Bachelorprojekt\Source code\pytello\test_Arucodetector.py", line 68, in setUp
    self.drone_controller.SetFuzzySystem()
  File "c:\Users\zaina\OneDrive\Skoleopgaver\Robotteknologi\Bachelorprojekt\Source code\pytello\Arucodetector.py", line 78, in SetFuzzySystem
    self.SetInputs()
  File "c:\Users\zaina\OneDrive\Skoleopgaver\Robotteknologi\Bachelorprojekt\Source code\pytello\Arucodetector.py", line 84, in SetInputs
    self.controller.produce_figure(outputfile = "x.png")
  File "C:\Users\zaina\anaconda3\lib\site-packages\simpful\simpful.py", line 722, in produce_figure
    raise Exception("ERROR: please, install matplotlib for plotting facilities")
Exception: ERROR: please, install matplotlib for plotting facilities

ZA0068 avatar Apr 26 '22 10:04 ZA0068

I encountered this error too. It happens because the import silently failed at the start, probably because you don't have the seaborn lib.

# simpful.py
try:
	from matplotlib.pyplot import plot, show, title, subplots, legend
	import seaborn as sns
	matplotlib = True
except ImportError:
	matplotlib = False

A simple workaround is to pip install 'seaborn' package.

TMPxyz avatar Apr 27 '22 09:04 TMPxyz

I have already installed seaborn, but that didn't worked

ZA0068 avatar Apr 27 '22 17:04 ZA0068

Hi @ZA0068 ,

matplotlib is an optional import in simpful, but it is mandatory if you want to use the plotting methods.

Could you verify to have correctly installed matplotlib (and seaborn, if you like it) on your working environment via pip freeze? You might also try to do a clean reinstall of the matplotlib package.

sspola avatar Apr 28 '22 14:04 sspola

I just pushed a new version 5ffb7605edccf75e1fcd45ce77972864a455e982, that makes seaborn fully optional. Matplotlib is still necessary for using the plotting facilities.

Thank you for pointing that out!

sspola avatar May 02 '22 10:05 sspola

ok ill check that out

ZA0068 avatar May 31 '22 12:05 ZA0068