holoviz / holoviz/hvplot

Categories written on top of each other for multiindex bar plot with Matplotlib backend

Open
#1,038 1 comment 0 reactions 0 assignees View on GitHub
upstream
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

I would expect to be able to use the a MultiIndex bar plot with the Matplotlib backend just as with the Bokeh backend. But unfortunately the categories are written on top of each other when using the Matplotlib backend.

![image](https://user-images.githubusercontent.com/42288570/224510324-e5cc43fd-88a7-4333-a29d-0a7f1078c0f4.png)

```python
import pandas as pd
import hvplot.pandas # noqa

from bokeh.sampledata.autompg import autompg_clean as autompg

autompg.head()

autompg_long_form = autompg.groupby("yr").mean(numeric_only=True).reset_index()
autompg_long_form.head()

autompg_multi_index = autompg.query("yr<=80").groupby(['yr', 'origin']).mean(numeric_only=True)
autompg_multi_index.head()

hvplot.extension("bokeh")
autompg_multi_index.hvplot.bar(width=1000, rot=90)

hvplot.extension("matplotlib")
autompg_multi_index.hvplot.bar(width=1000, rot=90)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.