I am using matplotlib 1.3.1 with python 3.4.0 on Ubuntu 14.04. I would like to use a matplotlibrc configuration file in .config/matplotlib/matplotlibrc
. However it seems like matplotlib is unable to find it:
~$ ls ~/.config/matplotlib/
matplotlibrc
~$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/usr/lib/python3/dist-packages/matplotlib/__init__.py:766: UserWarning: Could not find matplotlibrc; using defaults
warnings.warn('Could not find matplotlibrc; using defaults')
/usr/lib/python3/dist-packages/matplotlib/__init__.py:882: UserWarning: could not find rc file; returning defaults
warnings.warn(message)
The content of my matplotlibrc
is the default one from here .
How can I make matplotlib find the configuration file?
EDIT:
>>> matplotlib.get_configdir()
'/home/<me>/.matplotlib'
From the docstring of matplotlib.get_configdir()
I discovered that matplotlib will not look in ~/.config
if .matplotlib/
exists.
So even though ~/.config/matplotlib/matplotlibrc
exists, you should delete the ~/.matplotlib
directory entirely.
Note that I also had to delete matplotlib's fontcache afterwards.
I found mine here without having to delete the .matplotlib dir
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.