Skip to content

Rely on numpy to properly normalize histograms with unequal bin widths #8333

Closed

Description

@anntzer

The source of hist contains the following snippets:

        Notes
        -----
        Until numpy release 1.5, the underlying numpy histogram function was
        incorrect with `normed`=`True` if bin sizes were unequal.  MPL
        inherited that error.  It is now corrected within MPL when using
        earlier numpy versions.
        # hist_kwargs = dict(range=range, normed=bool(normed))
        # We will handle the normed kwarg within mpl until we
        # get to the point of requiring numpy >= 1.5.

and code for manual handling of the normed kwarg.

Given that we now require numpy >=1.7.1, we should just use the density kwarg to numpy.histogram to do this, and remove our own implementation.

Activity

  1. tacaswell commented on Mar 18, 2017

    @tacaswell
    Member

    #7856 is starting to move this direction.

  2. dstansby commented on Aug 29, 2017

    @dstansby
    Member

    So it turns out we're not actually testing normed histograms at all..... PR incoming

  3. added this to the milestone on Oct 20, 2017
  4. 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions