Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent PyCharm from overriding default backend as set in matplotlib?

I've set my default backend to Qt5Agg in .config/matplotlib/matplotlibrc. This works if I use a regular ssh prompt and open ipython and run import matplotlib as mpl

I correctly get: mpl.get_backend() => "Qt5Agg"

When I connect through pyCharm remote console, the default backend is set to 'module://backend_interagg' which seems to be a purpose built helper extension by pycharm.

Using mpl.use("Qt5Agg") works as expected (i.e. correctly sets the backend and allows me to use it).

I'm just trying to get the default working and the pycharm remote console to properly use my rc file parameters.

Fwiw, I've tried actually setting my master rc file (in the site-packages directory) to have Qt5Agg and I still get this problem.

Also, mpl.get_configdir() correctly returns ~/.config/matplotlib

Any ideas?

like image 203
MB. Avatar asked Mar 01 '18 11:03

MB.


People also ask

What is the default backend for Matplotlib?

In modern matplotlib there is no "default backend", i.e. the rcParams['backend'] is set to a "sentinel". Upon importing matplotlib the first working backend from a candidate list ["macosx", "qt5agg", "qt4agg", "gtk3agg", "tkagg", "wxagg"] is chosen.


1 Answers

I had the same problem in PyCharm 2017.3.3 and what helped was to disable the checkbox Show plots in toolwindow in File -> Settings -> Tools -> Python Scientific.

like image 89
l.hobert Avatar answered Sep 22 '22 15:09

l.hobert