FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

plt.hist does not obey the hist.bins rcparams · Issue #7356 · matplotlib/matplotlib · GitHub

Repository navigation

plt.hist does not obey the hist.bins rcparams #7356

Closed

Description

2.0b4 and master

import matplotlib as mpl
from matplotlib import pyplot as plt
import numpy as np

mpl.rcdefaults()
mpl.rcParams["hist.bins"] = "auto"

np.random.seed(1)
x = np.random.rand(1000)
n0, b0, p0 = plt.hist(x)
n1, b1, p1 = plt.hist(x, "auto")
print(n0)
print(n1)
plt.show()

The first histogram has 10 bins, the second one has 11 bins.

Note that this does not affect calling the hist method on an explicitly created Axes object.

Activity

  1. added this to the milestone on Oct 27, 2016
  2. added
    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    on Oct 27, 2016
  3. tacaswell commented on Oct 27, 2016

    Member

    We just need to re-run boilerplate.py

  4. anntzer commented on Oct 27, 2016

    ContributorAuthor

    Looking at the links at the top of boilerplate.py it seems that the reasons for its existence (rather than dynamically generating wrapper functions at import time) is

    • the __name__ of functions was not writable in Python 2.2, and
    • there was no way to preserve the signatures of the wrappees (until the introduction of function signature objects in Python 3.3).

    The first point is obviously no longer a problem. Regarding the second one, I see that IPython carries its own backport of Signature objects (https://github.com/ipython/ipython/blob/master/IPython/utils/_signatures.py), so it should be possible to at least display the correct signature within IPython (python2) even using dynamically generated wrappers.

    Or we could (very reasonably) just wait until Py2 support is dropped to get rid of boilerplate.py; in such a case, it may make sense to integrate the running of boilerplate.py into python setup.py build, so that we don't forget it?

  5. tacaswell commented on Oct 27, 2016

    Member

    There is an open issue for checking that we have run boiler plate in the tests #3701

    #3587 and #2736 are two half-started attempts to generate pyplot at run time. #4488 is a pass at a helper decorator for the same purpose.

    There was some concern about the generating at runtime approach messing with static code analysis tools (like pycharm's auto complete / suggestions).

    We do currently use their signature backport, but only if we are already in an IPython sessions (which we check by seeing if IPython is already in the sys.modules).

  6. anntzer commented on Oct 27, 2016

    ContributorAuthor

    Given that pycharm even supports PEP484 semantics for type annotations (https://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html), I would be amazed that it is not able to support signature objects...

  7. NelleV commented on Nov 10, 2016

    Member

    This is fixed in both master and v2.x as of yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL