问题描述
我最近从v2.0.0升级了matplotlib v1.5.3,但是通过这个更改,似乎matplotlib在绘制数字时不再使用我编辑的matplotlibrc文件。当我打开matplotlibrc文件时,我发现我的更改实际上已实现,但是当我键入 matplotlib.rcParams
时,不会显示这些更改。考虑到它可能正在查看不同的matplotlibrc文件,我运行 matplotlib.matplotlib_fname()
,但这指向我编辑的matplotlibrc文件的同一目录。
I recently upgraded from matplotlib v1.5.3 from v2.0.0, but with this change, it seems that matplotlib no longer uses my edited matplotlibrc file when plotting figures. When I open the matplotlibrc file, I see that my changes are in fact implemented, but when I type matplotlib.rcParams
, these changes are not displayed. Thinking that maybe it was looking at a different matplotlibrc file, I ran matplotlib.matplotlib_fname()
, but this points to the same directory of my edited matplotlibrc file.
有谁知道这里发生了什么?
Does anyone know what's going on here?
仅供参考我在Python 2.7中运行matplotlib 2.0.0 .12与IPython 5.1.0。要在IPython中打开matplotlib,我首先使用命令%matplotlib
。
FYI, I am running matplotlib 2.0.0 in Python 2.7.12 with IPython 5.1.0. To open matplotlib in IPython, I utilize first the command %matplotlib
.
推荐答案
在matplotlib 2.0.0中,Linux上的默认位置为 matplotlibrc
文件已移出
In matplotlib 2.0.0, the default location on Linux for the matplotlibrc
file has moved from
~/.matplotlib/matplotlibrc
到
~/.config/matplotlib/matplotlibrc
尝试将自定义文件移动到那里,看看它是否有效。当我从1.5.3移动到2.0.0时,这对我有用。
Try moving your customised file to there and see if it works. That worked for me when I moved from 1.5.3 to 2.0.0.
参见,了解有关如何找到正确的matplotlibrc文件的更多信息。
See the docs for more info on how it finds the right matplotlibrc file.
这篇关于matplotlib在IPython中没有使用matplotlibrc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!