Skip to main content

Hist classes and utilities

Project description


Github Actions badge Join the chat at Code style: black

Hist is a analyst friendly front-end for boost-histogram.


You can install this library from PyPI with pip:

python -m pip install hist


import hist

# You can create a histogram like this.
h = (
  .Reg(10, 0 ,1, name="x", label="x-axis")
  .Variable(range(10), name="y", label="y-axis")

# Filling by names is allowed in hist.
hist.fill(y=[1, 4, 6], x=[3, 5, 2])

# New ways to manipulate the histogram.
h[{"y": 1j + 3, "x": 5j}]

# Elegant plotting functions.


  • Hist augments metadata by adding names to axes; these are highly recommend and will help you track axes. There is also a special NamedHist, which will enforce all hist axes have names, and all axes will require named access.

    • name= is a unique label describing each axis
    • label= is an optional string that is used in plotting (defaults to name if not provided)
    • Indexing, projection, and more support named axes.
  • The Hist class augments the bh.Histogram class with the following shortcuts, designed for interactive exploration without extensive imports:

    • Optional import-free construction system
    • Quick import-free data-coordinates and rebin syntax (use a j suffix for numbers, or strings directly in indexing expressions)
  • Quick plotting routines encourage exploration:

    • .plot() provides 1D and 2D plots
    • .plot2d_full() shows 1D projects around a 2D plot
    • .plot_pull(...) performs a pull plot


python -m pip install hist

See for information on setting up a development environment.


We would like to acknowledge the contributors that made this project possible (emoji key):

Henry Schreiner

🚧 💻 📖

Nino Lau

🚧 💻📖

This project follows the all-contributors specification.



This library was primarily developed by Henry Schreiner and Nino Lau.

Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hist, version 2.0.0b1
Filename, size File type Python version Upload date Hashes
Filename, size hist-2.0.0b1-py3-none-any.whl (16.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hist-2.0.0b1.tar.gz (225.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page