Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (51 sloc) 2.25 KB

Customized style

Styles in GooseMPL

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'name_of_custom_style')

A number of styles are available. To list them use

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


More information in the matplotlib documentation


Combining styles

Combining different styles is easily accomplished by including a list of styles. For example:['dark_background','presentation'])

Temporary styling

To compose parts of the plot with a different style use:

    plt.plot(np.sin(np.linspace(0, 2 * np.pi)))


To get the available fields do the following:

import matplotlib as mpl

You can’t perform that action at this time.