Skip to content

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

Closed

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

  1. mdboom commented on Jan 14, 2016

    @mdboom
    Member

    I think this is fixed by #5598 #5593.

  2. halflings commented on Jan 14, 2016

    @halflings
    Author

    Great!

    Seems like the pandas people did a work around to fix this ( pandas-dev/pandas#11865 ), I hope both fixes won't conflict with each other :)

  3. jenshnielsen commented on Jan 14, 2016

    @jenshnielsen
    Member

    @mdboom I remember that we talked about this issue sometime back but Is that the right PR? It only related to mplot3d as far as I can see

  4. mdboom commented on Jan 14, 2016

    @mdboom
    Member

    Sorry -- I mistyped the PR number. It's #5593.

  5. halflings commented on Jan 15, 2016

    @halflings
    Author

    Since it seems like this was addressed previously, closing the issue. Thanks!

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