Thanks to visit codestin.com
Credit goes to github.com

Skip to content

boxplot treats iterables differently by type #2539

Closed
@jseabold

Description

@jseabold

It's stated in the documentation, but I find this behavior to be rather wart-y, and it led to some bugs in statsmodels. Why treat x array different from x sequence of lists?

For an array it iterates over the first axis

import numpy as np
import matplotlib.pyplot as plt

x = np.random.normal(size=(2,1000))
fig, ax = plt.subplots()

ax.boxplot(x.T)

for lists it iterates over the zero axis

fig, ax = plt.subplots()
ax.boxplot([x[0,:],x[1,:]])

Why the distinction? I'd expect them to be the same (i.e., the list gets an np.asarray call) and it seems inconsistent that they're not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions