0
在jupyter笔记本电脑,我可以运行在Jupyter中,我怎样才能默认使用matplotlib ggplot风格?
plt.style.use('ggplot')
并允许我使用ggplot风格地块。我怎么能把这个默认值放在某个配置文件中呢?
在jupyter笔记本电脑,我可以运行在Jupyter中,我怎样才能默认使用matplotlib ggplot风格?
plt.style.use('ggplot')
并允许我使用ggplot风格地块。我怎么能把这个默认值放在某个配置文件中呢?
单向将使用IPython的启动文件为所有IPython会话运行任意脚本。 要使用此功能,您需要将任何file.py
放入<user-home-dir>/.ipython/profile_default/startup
文件夹中。 此文件可以有这样的代码,这将在执行时IPython的开始:
import matplotlib.pyplot as plt
plt.style.use('ggplot')
另一种方法是与ggplot
设置,您可以用得到修改matplotlibrc
:
plt.style.library['ggplot']
将输出:
RcParams({u'axes.axisbelow': True,
u'axes.edgecolor': u'white',
u'axes.facecolor': u'#E5E5E5',
u'axes.grid': True,
u'axes.labelcolor': u'#555555',
u'axes.labelsize': u'large',
u'axes.linewidth': 1.0,
u'axes.prop_cycle': cycler(u'color', [u'#E24A33', u'#348ABD', u'#988ED5', u'#777777', u'#FBC15E', u'#8EBA42', u'#FFB5B8']),
u'axes.titlesize': u'x-large',
u'figure.edgecolor': u'0.50',
u'figure.facecolor': u'white',
u'font.size': 10.0,
u'grid.color': u'white',
u'grid.linestyle': u'-',
u'patch.antialiased': True,
u'patch.edgecolor': u'#EEEEEE',
u'patch.facecolor': u'#348ABD',
u'patch.linewidth': 0.5,
u'xtick.color': u'#555555',
u'xtick.direction': u'out',
u'ytick.color': u'#555555',
u'ytick.direction': u'out'})
在末尾粘贴matplotlibrc
中的那些行(key : value
部分)将使ggplot
样式默认生效。