In an non-obvious fashion, sometimes bars get wrong width. Specifically, each subsequent bar expands in width versus the prior one. However, it does this for some datasets but not for others, with no pattern obvious to me.
Code for reproduction
Simplified from my actual code, but this demonstrates problem.
Under Matplotlib 3.1.1 I get this distorted effect:
It appears that each subsequent bar is Nx wider. I.e. first bar is fine, next is 2x width, next is 3x width, etc.
Even stranger, the distortion applies only to the "Men" bars. This is true if I change the order they are rendered in, and also is true if I comment out one or the other set of bars. I.e. women are fine, whether displayed solely or in combo; men are broken whether or not the women bars are displayed.
Expected outcome
Under Matplotlib 3.0.3, the output looks as desired. Specifically, the two sets of bars overlay each other with one narrower to aid reading both sets.
Matplotlib version
Operating system: Linux popbmi 5.0.0-28-generic Overhaul make.osx in master #30-Ubuntu SMP Wed Sep 4 11:47:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Thanks for reporting this. This issue has already been reported in #15162. It's been fixed by #15166 and will hence be available once matplotlib 3.1.2 is released.
Activity
ImportanceOfBeingErnest commented on Sep 30, 2019
Thanks for reporting this. This issue has already been reported in #15162. It's been fixed by #15166 and will hence be available once matplotlib 3.1.2 is released.
ImportanceOfBeingErnest commented on Sep 30, 2019
Forgot to say: You can for now easily work around this by making sure to use a zero indexed dataframe