How to set matplotlib default style?

When using matplotlib I try to use

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

quiet. Is there an easy way to change the default style to ggplot (or any other style)? I looked through the "matplotlibrc" documentation, but could not find a suitable option.

Is there a better way to copy / link a system-wide .mplstyle?

Thank!

+4
source share
3 answers

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 the ipython_config.py file.

+2
source

Create a file (call it, for example, startup-01.py) in ~ / .ipython / profile_default / start /

( profile_default)

( ipython),

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

## other settings, e.g.
# plt.rcParams['figure.figsize'] = (10.0, 8.0)
+1

matplotlib. docs:

matplotlib matplotlibrc , rc rc. matplotlib: dpi, , , , , ..

matplotlibrc :

import matplotlib
matplotlib.matplotlib_fname()

, ggplot matplotlibrc. ggplot ( ) matplotlib.

0

All Articles