Bar and box plots use the 'default' matplotlib colormap, even if the style is changed · Issue #5851 · matplotlib/matplotlib · GitHub
Skip to content

Bar and box plots use the 'default' matplotlib colormap, even if the style is changed #5851

Description

@halflings

I originally thought this was an issue with pandas ( pandas-dev/pandas#12029 ), but I can reproduce it by using matplotlib alone.

After changing the style to "fivethirtyeight" (with pyplot.style.use("fivethirtyeight") ) and changing the default colormap (via rcParams), both bar plots and boxplots still use the default colors:

plt.plot([0, 1, 2, 3], [5, 6, 7, 8])
plt.plot([0, 1, 2, 3], [6, 3, 7, 12], alpha=0.5)

lineplot

plt.bar([0, 1, 2, 3], [5, 6, 7, 8])
plt.bar([0, 1, 2, 3], [6, 3, 7, 12], alpha=0.5)

barplot

plt.boxplot([6, 3, 7, 12, 20, 25, 33])

boxplot

The code I used to customize the plotting style can be found on the pandas issue (like I said, it's mostly just setting the style to fivethirtyeight then changing the color cycle)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions