Skip to content

boxplot treats iterables differently by type #2539

Closed

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.

Activity

  1. efiring commented on Oct 27, 2013

    @efiring
    Member

    From the general mpl and python standpoints, I agree entirely with @jseabold. It is unfortunate that this aspect of the signature is present; the question is what, if anything, to do about it now.

  2. tacaswell commented on Jan 22, 2014

    @tacaswell
    Member

    @jseabold Have you seen PR #2643 to overhaul boxplot by @phobson?

  3. added this to the milestone on Aug 17, 2014
  4. tacaswell commented on Aug 17, 2014

    @tacaswell
    Member

    This might have to get punted to 2.0

  5. modified the milestones: , on Oct 3, 2017
  6. anntzer commented on Oct 19, 2017

    @anntzer
    Contributor

    I think most of the discussion is in #8092 now.

  7. modified the milestones: , v2.2.0 on Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions