The default style configuration of matplotlib is made to satisfy the requirements of a wide audience, but this means that we always have to spend some time customizing the details that we care about. In this recipe, we want to show how to create custom and reusable styles for matplotlib so that we make our changes only once.
All the styles that matplotlib can use are stored in a directory called stylelib
, under the configuration directory of matplotlib. To check the path of this directory, we can use the get_configdir()
method:
In [1]: import matplotlib In [2]: matplotlib.get_configdir() Out[2]: u'~/.matplotlib'
In this directory we will store the files that specify our custom styles.