matplotlib/cheatsheets

Missing name style

fgomezdelarosa opened this issue · 6 comments

Thanks for the great cheatsheets!

The first page in Matplotlib cheatsheets, chart "style name" missing in "Style" - plot (2,1), that looks like "ggplot"

I think the name is here but the style make title white on a gray background that makes it difficult to see.

Then, the question is why the title is white. Here https://matplotlib.org/devdocs/gallery/style_sheets/style_sheets_reference.html the title is black.

And why do I have a grey background? This is the script I use to generate the style figures:

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

styles = ['default'] + plt.style.available

for style in styles:
    fig = plt.figure(figsize=(5,3), dpi=100)
    plt.style.use(style)
    ax = plt.subplot(1,1,1)
    X = np.linspace(0,2*np.pi, 256)
    Y = np.cos(X)
    ax.plot(X,Y)
    plt.title(style, family="Source Serif Pro", size=32)
    plt.tight_layout()
    # plt.show()
    plt.savefig("../figures/style-%s.pdf" % style)
    plt.close(fig)

Obvious difference is that I do not use context. Could this be the reason ?

I think styles currently do only change the rcParams they need relative to default. So some earlier style overwrites the global state and it is not reset. We probably should do something about this, but for now you should either use a context or always activate default and then a new style.

Out of curiosity, how do you activate default ?

(Nevermind, I had only seen the last two comments from Tim and Nicolas, but obviously @rougier already knows about ```plt.style.use(["default", "another_style”])… Sorry for the noise.)