pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
1.9k stars 284 forks source link

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. #144

Closed DidierRLopes closed 3 years ago

DidierRLopes commented 3 years ago

I'm using a MacOS, and whenever I import this module I get this:

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

when trying to plot.

I think the issue is that my default backend is MacOSX, and when I import this, your module is forcing it to be changed to agg.

I think probably due to this: https://github.com/pmorissette/ffn/blob/0575a43cdfd4d66eb3d8cc638f45d9595e889022/ffn/core.py#L33

MDDietz1 commented 3 years ago

Duplicate of #141

I think it is an issue, my workaround: I can get ffn output in Spyder as expected by adding the following at the beginning of my file to make sure there is an empty DISPLAY variable set. import os os.environ['DISPLAY'] = '' Alternatively, you can import ffn then reset matplotlib to Inline (%matplotlib Inline) and then run commands that print output

nkonts commented 2 years ago

What is the reasoning behind overwriting the default matplotlib backend when importing ffn? I was confused that suddenly my plots disappeared. While setting/changing the environment variable fixes it, I think that this behaviour is quite counter intuitive.