Skip to content

BUG/VIS: Pie Plot with subplots doesn't include NaNs in legend #8390

Closed
@TomAugspurger

Description

@TomAugspurger

Followup to #8307

In [1]: df = pd.DataFrame(np.random.rand(4, 4))

In [2]: df2 = df.copy()

In [3]: for i in range(len(df)):
   ...:     df.iloc[i, i] = np.nan
   ...:     

In [4]: fig, axes = plt.subplots(figsize=(16, 8), nrows=2, ncols=4)

In [5]: df.plot(kind='pie', subplots=True, ax=axes.ravel()[:4])
In [6]: df2.plot(kind='pie', subplots=True, ax=axes.ravel()[4:])

ex

Right now, when subplots=True, the NaN/zero labels aren't being put in the legend (or they aren't showing up).

In [8]: df[0].plot(kind='pie', figsize=(4,4), legend=True)

ex2

Not a huge priority, we'll see if anyone notices and wants to implement a fix. I think it would involve refactoring all our legend and ticklabels code to be subplot aware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions