Reputation: 11321
In a jupyter notebook, I can run
plt.style.use('ggplot')
And that allows me to use the ggplot style for plots. How can I make this default, say, by putting it in a config file somewhere?
Upvotes: 1
Views: 3019
Reputation: 10302
One way would be to use IPython's startup files to run arbitrary script for all IPython sessions.
For this to work you would need to place any file.py
into <user-home-dir>/.ipython/profile_default/startup
folder.
This file can then have this code, which will be executed when IPython starts:
import matplotlib.pyplot as plt
plt.style.use('ggplot')
Another approach is to modify the matplotlibrc
with settings of ggplot
which you can get with:
plt.style.library['ggplot']
Which will output:
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'})
Pasting those lines (key : value
part) in matplotlibrc
at the end will make ggplot
style effective by default.
Upvotes: 6