When using matplotlib, I tend to use
import matplotlib.pyplot as plt
plt.style.use('ggplot')
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.
Is there a better way then copying/linking the system-wide .mplstyle?
Thanks!
You can change the settings file of matplotlib. According to the docs :
matplotlib uses matplotlibrc configuration files to customize all kinds of properties, which we call rc settings or rc parameters. You can control the defaults of almost every property in matplotlib: figure size and dpi, line width, color and style, axes, axis and grid properties, text and font properties and so on.
You can locate your matplotlibrc file with the following command:
import matplotlib
matplotlib.matplotlib_fname()
Hence we can put ggplot settings at the end of the matplotlibrc file. You can easily find ggplot style (as well as other styles) on official matplotlib repository.
Apparently, there is no such option (yet).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With