The following styles are part of GooseMPL (they become available upon installing GooseMPL):
goose
Customized layout settings.
goose-latex
Extend a style to enable the use of LaTeX, and change the font to LaTeX default Computer Modern font.
goose-tick-in
Place the tick-markers (the little lines) at the inside of the axes rather than at the outside.
goose-tick-lower
Shown only axes on the bottom and left side of the figure (those on the top and right are not shown).
See the :ref:`examples-pyplot`.
Matplotlib has a very convenient way to customize plots while minimizing the amount of customized code needed for this. It employs easy-to-switch plotting styles with the same parameters as a matplotlibrc
file. The only thing needed to switch styles is:
import matplotlib.pyplot as plt
plt.style.use('name_of_custom_style')
A number of styles are available. To list them use plt.style.available
.
Also, one can use one's own style. This is a plain-text file name_of_custom_style.mplstyle
stored in a sub-directory stylelib
of the Matplotlib configuration directory; e.g.:
~/.matplotlib/stylelib/ # MacOS/Linux
~/.config/matplotlib/stylelib/ # MacOS/Linux
The exact directory depends on the operating system and the installation. To find the directory to use on your system, use:
import matplotlib
matplotlib.get_configdir()
Note
More information in the matplotlib documentation
Combining different styles is easily accomplished by including a list of styles. For example:
plt.style.use(['dark_background','presentation'])
To compose parts of the plot with a different style use:
with plt.style.context(('presentation')):
plt.plot(np.sin(np.linspace(0, 2 * np.pi)))
To get the available fields do the following:
import matplotlib as mpl
print(mpl.rcParams)