如何设置默认的 matplotlib 样式? [英] How to set default matplotlib style?

查看:83
本文介绍了如何设置默认的 matplotlib 样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 matplotlib 时,我倾向于使用

When using matplotlib, I tend to use

import matplotlib.pyplot as plt
plt.style.use('ggplot')

经常安静.有没有一种简单的方法可以将默认样式更改为ggplot(或任何其他样式)?我查看了matplotlibrc"文档,但找不到合适的选项.

quiet often. Is there an easy way to change the default style to ggplot (or any other style)? I looked into the 'matplotlibrc'-documentation but was unable to find an appropriate option.

是否有比复制/链接系统范围的.mplstyle更好的方法?

Is there a better way then copying/linking the system-wide .mplstyle?

谢谢!

推荐答案

显然,还没有这样的选择.

Apparently, there is no such option (yet).

但是,您可以通过在ipython_config.py中的c.InteractiveShellApp.exec_lines中添加"plt.style.use('ggplot')"来告诉iPython启动时加载ggplot样式.

However, you can tell iPython to load the ggplot style at startup, by adding "plt.style.use('ggplot')" to c.InteractiveShellApp.exec_lines in ipython_config.py.

这篇关于如何设置默认的 matplotlib 样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆