Skip to content

Commit 5b40eed

Browse files
committed
ENH: Add UserWarning when plotting bar plot with MultiIndex
1 parent 6c64cc1 commit 5b40eed

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/source/user_guide/visualization.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ Asymmetrical error bars are also supported, however raw error values must be pro
14021402
Here is an example of one way to easily plot group means with standard deviations from the raw data.
14031403

14041404
.. ipython:: python
1405+
:okwarning:
14051406
14061407
# Generate the data
14071408
ix3 = pd.MultiIndex.from_arrays([
@@ -1683,4 +1684,4 @@ to generate the plots. Some libraries implementing a backend for pandas are list
16831684
on the ecosystem :ref:`ecosystem.visualization` page.
16841685

16851686
Developers guide can be found at
1686-
https://dev.pandas.io/docs/development/extending.html#plotting-backends
1687+
https://dev.pandas.io/docs/development/extending.html#plotting-backends

pandas/plotting/_matplotlib/core.py

+3
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,9 @@ def __init__(self, data, **kwargs):
13191319

13201320
if isinstance(self.data.index, ABCMultiIndex):
13211321
# No real handling for MultiIndex yet
1322+
warnings.warn(
1323+
"Bar plot with a MultiIndex is not supported.", UserWarning,
1324+
)
13221325
self.ax_index = np.arange(len(data))
13231326
else:
13241327
self.ax_index = self.data.index

0 commit comments

Comments
 (0)