Skip to content

_reshape_2D function behavior changed, breaks hist for some cases in 3.3.0 #18234

Closed
@RyanBaten

Description

@RyanBaten

Bug report

Bug summary

In version 3.2.2, plt.hist(df['class']) will produce a correct histogram where df['class'] is a series of strings. In version 3.3.0, _reshape_2D gives different output in this case, leading to slow computation and a graph with too many bars.

Code for reproduction

import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('titanic')
plt.hist(df['class'])

Actual outcome

This is under matplotlib 3.3.0:
image

This is _reshape_2D under 3.3.0:
image

Expected outcome

This is under matplotlib 3.2.2:
image

This is _reshape_2D under 3.2.2:
image

Can produce the same output for 3.3.0 by putting the series in a list but ideally I think the behavior should remain the same since this unexpectedly also breaks other function behavior relying on this (pandas.DataFrame.hist(), plt.hist())

Matplotlib version

  • Operating system: macOS Mojave 10.14.6
  • Matplotlib version: 3.3.0
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.4
  • Jupyter version (if applicable):
  • Other libraries: numpy: 1.18.1, pandas: 1.1.0, seaborn: 0.9.0

matplot lib installed via pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions