Matplotlib:在seaborn imp之后忽略matplotlibrc文件

2024-09-26 22:54:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个带有matplotlib配置选项的自定义matplotlibrc文件,遵循here过程。当我第一次启动Jupyter QtConsole时(如果需要的话,通过终端),文件正在被读取,请使用我设置的选项,例如虚线网格线:

%matplotlib inline

plt.plot([1, 2, 3])
Out[2]: [<matplotlib.lines.Line2D at 0x9d2fe80>]

enter image description here

matplotlibrc文件如下:

mpl.matplotlib_fname()
Out[4]: 'C:\\Users\\my_username\\.matplotlib\\matplotlibrc'

但如果我输入seaborn:

import seaborn as sns

绘图然后切换到seaborn样式:

plt.plot([1, 2, 3])
Out[6]: [<matplotlib.lines.Line2D at 0xceb9cc0>]

enter image description here

是否可以在导入seaborn的同时保留原始打印样式?我想使用它的功能,比如seaborn.heatmap,但不想使用它的样式。你知道吗


Tags: 文件hereplotmatplotlib过程选项jupyterplt

热门问题