Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aminnj/yahist
1D and 2D histogram objects
https://github.com/aminnj/yahist
histogram matplotlib numpy plotly plotting
Last synced: 3 months ago
JSON representation
1D and 2D histogram objects
- Host: GitHub
- URL: https://github.com/aminnj/yahist
- Owner: aminnj
- Created: 2019-10-28T22:30:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-18T01:27:22.000Z (8 months ago)
- Last Synced: 2024-10-02T05:01:30.514Z (3 months ago)
- Topics: histogram, matplotlib, numpy, plotly, plotting
- Language: Python
- Homepage:
- Size: 9.08 MB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Yet another histogram
![Python application](https://github.com/aminnj/yahist/workflows/Python%20application/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/yahist.svg)](https://pypi.python.org/pypi/yahist/)
[![Documentation Status](https://readthedocs.org/projects/pip/badge/?version=latest)](https://aminnj.github.io/yahist/)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/aminnj/yahist/master?filepath=examples%2Fbasic.ipynb)```bash
pip install yahist
```### Examples ([API docs](https://aminnj.github.io/yahist/))
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/aminnj/yahist/master?filepath=examples%2Fbasic.ipynb)
(static [nbviewer](https://nbviewer.jupyter.org/url/github.com/aminnj/yahist/blob/master/examples/basic.ipynb) if Binder is slow)### Overview
Histogram objects (1D and 2D) with easy manipulations (`numpy`), plotting (`matplotlib`), and fitting (`scipy`/`iminuit`).
```python
import numpy as np
from yahist import Hist1Dv = np.random.normal(0, 1, 1000)
h = Hist1D(v, bins=100, label="data").rebin(2).normalize()
h.plot(errors=True, ms=3)
h.fit("peak * np.exp(-(x-mu)**2 / (2*sigma**2))")
``````python
import pandas as pddf = pd.DataFrame(np.random.normal(0, 1, size=(10000, 2)), columns=["A", "B"])
h = Hist2D(df, bins="30,-3,3", threads=4)
h.plot(logz=True, cmap="cividis")
h.profile("x").plot(errors=True, color="C1", marker=".", label="x-profile")
```Much more functionality is showcased in the example notebook, including
* fitting (chi2 or likelihood)
* interactive plots (via `bokeh`)
* datetime inputs/axes
* rebinning/subsetting
* profiling/projecting 2D histograms
* acceleration of 1D/2D histogram creation with [boost-histogram](https://github.com/scikit-hep/boost-histogram)
* using the histogram as a lookup function
* serialization to/from json...and more.