Skip to content

matplotlib-1.2.0: regression in histogram with barstacked drawing? #1679

Closed

Description

@mmokrejs

To: Matplotlib-users@lists.sourceforge.net
Message-ID: 50DF638E.80904@fold.natur.cuni.cz

Hi,
I recently updated to matplotlib-1.2.0 from 1.1.1 and my figures have rotated
order of color bars stacked upon each other. Here is a small testcase I sketched
now and two generated png files are attached, generated by the two different
matplotlib versions. The colornames are just bad in the legend, just to show that
the order of input data is same in both cases.

I would be grateful for any comments on this.
Thank you,
Martin

! /usr/bin/python

import pylab

F = pylab.gcf()

F.set_size_inches(11.2, 8.4)

_e = [[100, 100, 100, 100, 200, 320, 450, 80, 20, 600, 310, 800], [20, 23, 50, 11, 100, 420], [120, 120, 120, 140, 140, 150, 180], [60, 60, 60, 60, 300, 300, 5, 5, 5, 5, 10, 300], [555, 555, 555, 30, 30, 30, 30, 30, 100, 100, 100, 100, 30, 30], [30, 30, 30, 30, 400, 400, 400, 400, 400, 400, 400, 400]]
_ee = [(0.5759849696758961, 1.0, 0.0), (0.0, 1.0, 0.350624650815206), (0.0, 1.0, 0.6549834156005998), (0.0, 0.6569064625276622, 1.0), (0.28302699607823545, 0.0, 1.0), (0.6849123462299822, 0.0, 1.0)]
_eee = ['green', 'orange', ' yellow', 'magenta', 'black']

pylab.hist(_e, bins=10, histtype='barstacked', align='mid', color=_ee, log=False, label=_eee)

pylab.legend(loc='upper right', bbox_to_anchor = (1.0, 1.0), ncol=1)

F.savefig("hist_barstacked_bug.png", dpi=100)

Activity

  1. mmokrejs commented on Jan 17, 2013

    @mmokrejs
    Author

    Uploading hist_barstacked_bug__mpl-1.1.1.png . . .
    Uploading hist_barstacked_bug__mpl-1.2.0.png . . .

  2. dmcdougall commented on Jan 18, 2013

    @dmcdougall
    Member

    v1.1.1:

    hist_barstacked_bug__mpl-1 1 1

    v1.2.0

    hist_barstacked_bug__mpl-1 2 0

  3. mdboom commented on Jan 25, 2013

    @mdboom
    Member

    git bisect tells me the culprit is 7ba1743, but not sure exactly what the fix is yet.

  4. neggert commented on Jan 25, 2013

    @neggert
    Contributor

    I suspect you're correct. I'll take a look at it this weekend

  5. mmokrejs commented on Jan 25, 2013

    @mmokrejs
    Author

    Michael Droettboom wrote:

    git bisect tells me the culprit is 7ba1743 7ba1743, but not sure exactly what the fix is yet.

    Hi,
    thanks for your work on this. BTW, I also notice that also a barstacked chart with log Y-axis
    is also affected. Probably same underlying issue.
    Martin

  6. neggert commented on Jan 26, 2013

    @neggert
    Contributor

    Alright, I think I remember now what I did. Since the stacked histogram is done by putting later histograms over the top of previous one, the upper-most one needed to be plotted first.

    This approach of layering the patches seems to be causing other problems as well (#1631), so I may need to revisit how this is implemented. I seem to remember having problems with it when using fill_between, as suggested there. I'll take another stab at it and if I get stuck I'll submit the PR so others can take a look.

  7. dmcdougall commented on Jan 26, 2013

    @dmcdougall
    Member

    @neggert I think histograms can take a bottom= kwarg. Can you stack them that way instead?

  8. dmcdougall commented on Jan 26, 2013

    @dmcdougall
    Member

    @neggert I think histograms can take a bottom= kwarg. Can you stack them that way instead?

    Scratch that. I think I was thinking of Axes.bar().

  9. mdboom commented on Mar 1, 2013

    @mdboom
    Member

    Closing since the relevant pull requests have been merged. 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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions