question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

regression: bar plot with multi-column category doesn't work anymore

See original GitHub issue

Code Sample, a copy-pastable example if possible

Doing a bar plot using a multi-column category used to work

df.plot.barh(x=['fruit', 'animal'], y='size')

In pandas 0.22.0: screen shot 2018-06-08 at 16 34 51

since pandas 0.23.0: screen shot 2018-06-08 at 16 39 36

Is it intended that this stopped working? I kind of liked the feature.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
soxofaancommented, Jun 12, 2018

@daminisatya yes, as far as I know this is not yet resolved

0reactions
TomAugspurgercommented, Jun 13, 2018

Allowing multiple x might make sense for bar / barh.

FWIW, I would personally do this with df.set_index([‘fruit’, ‘animal’])[‘size’].plot.bar()

On Wed, Jun 13, 2018 at 4:12 AM, Stefaan Lippens notifications@github.com wrote:

@MasonGallo https://github.com/MasonGallo : I just used barh to make sure the screenshot was easily readable, The “feature” also used to work for standard bar in pandas 0.22: [image: screen shot 2018-06-13 at 10 48 04] https://user-images.githubusercontent.com/44946/41340291-521128e2-6ef7-11e8-821e-be14f586f56e.png

The change was intentional to conform with the api & docs

I understand for the use case of line and scatter plots, but for categorical plots like bar (and pie see lower), I think it would be an interesting feature to bring back support for multi-column based labels. Is there interest for that @TomAugspurger https://github.com/TomAugspurger ?

The signature of barh in pandas is quite confusing to me

In my mind, the x/y handling in barh makes sense as I see barh as a flipped version of bar: the x-axis is drawn vertically and y-axis is drawn horizontally. During data exploration, I usually switch between bar and barh functions names to improve readability of the labels, and in that process I don’t want to also change the arguments of those functions. That being said, I think the axis handling of barh is probably another discussion and out of scope of this ticket.

For completeness I also tried it out with pie, but there the x argument seems to be ignored completely, so it kind of works with both 0.22 and 0.23. However, the pie piece labels come from the index instead of the given x column. But that is probably another (known) issue. [image: screen shot 2018-06-13 at 10 49 45] https://user-images.githubusercontent.com/44946/41340518-e0ed1c4c-6ef7-11e8-9b93-ed97ea6b3bca.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pandas-dev/pandas/issues/21386#issuecomment-396870226, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQHInXYqoecXRFXxguCDPJM7pyzrFWgks5t8NdogaJpZM4UgdDm .

Read more comments on GitHub >

github_iconTop Results From Across the Web

R - Grouped Bar Plot with multi-column data - Stack Overflow
I tend to use facet_wrap() or facet_grid() to get multiple groups onto my bar plots. This should work to create similar output as...
Read more >
Bar Chart / Bar Graph: Examples, Excel Steps & Stacked Graphs
A bar chart is a graph with rectangular bars. The graph usually compares different categories. Although the graphs can be plotted vertically (bars...
Read more >
Visualization with Plotly.Express: Comprehensive guide
A detailed guide on how to create many visualizations with Plotly Express with layout styling, interactivity, animations, and many chart ...
Read more >
Origin Help - Grouped Columns - Indexed Data - OriginLab
Highlight column B and select Plot > 2D: Bar: Grouped Columns - Indexed Data from top menu to open the plot_gindexed dialog. In...
Read more >
Clustered and Stacked Column and Bar Charts - Peltier Tech
The first step is to make a stacked column or bar chart from the data in B6:E9. There are no categories selected (i.e.,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found