8000 Regression: _reshape_2D no longer preserves the shape of lists of lists of one scalar each · Issue #17820 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Regression: _reshape_2D no longer preserves the shape of lists of lists of one scalar each #17820
Closed
@alexhenrie

Description

@alexhenrie

In Matplotlib 3.2.1, the following code worked:

from matplotlib.pyplot import boxplot
boxplot([[1],[2],[3]], positions=[1,2,3])

However, in Matplotlib 3.3.0 the same code throws the following error:

ValueError: List of boxplot statistics and `positions` values must have same the length

I'm working on a project which generates lots of boxplots automatically and occasionally each boxplot only has 1 datapoint, so it's important for that case to work.

git bisect revealed that the problem is changed behavior in the _reshape_2D function:

ac018af76cae81054dd27c2d4039dfd5467a1366 is the first bad commit
commit ac018af76cae81054dd27c2d4039dfd5467a1366
Author: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date:   Tue May 5 23:53:00 2020 -0400

    Rewrite _reshape_2D to not use ragged ndarrays.
    
    This is a raising a deprecation warning in NumPy 1.19, may go away some
    time later, and is not strictly necessary for the implementation.

 lib/matplotlib/cbook/__init__.py | 46 ++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 11 deletions(-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0