Easy Histogram
This is a very small python package used to make histograms in python, and optionally plot them with matplotlib. The underlying histogramming tool is from numpy. This provides a very handy wrappers around them to easily make common histograms in 1d and 2d and plot with nice labels.
Installation
$ pip install easyhist
Usage
You can import the library and make histograms and plot them(optionally)
import numpy as np
import matplotlib.pyplot as plt
import easyhist as eh
# initialize data
x = np.random.normal(0,1,10000)
h = eh.Hist1D(x,bins='auto')
The returned histogram object has a handy plot method which uses matplotlib to plot the histogram.
fig,ax = plt.subplots(1,1,figsize=(12,6))
h.plot(ax)
The histogram comes by default with error bars. Different keyword parameters can be passed to customise the histogram.
fig,ax= plt.subplots(1,1,figsize=(12,6))
h.plot(ax,steps=True,ebar=False,filled=True)
Axes labels and titles can be passed to the plot function.
fig,ax= plt.subplots(1,1,figsize=(12,6))
h.plot(ax,steps=True,ebar=False,filled=True,xlabel='x (unit)',ylabel='y(unit)',title='Test')
Many times we have to fit gaussian to the histogram. An easy fit_normal method is provided with fits normal_distribution to the dateset.
h_fited = h.fit_normal()
Since the fitted object is an instance of Hist1D we can use the plot method as above to plot.
fig,ax= plt.subplots(1,1,figsize=(12,6))
h_fited.plot(ax,steps=True,ebar=False,filled=True,xlabel='x (unit)',ylabel='y(unit)',title='Test')
2D Histogram
The library naturally has Hist2D class for 2D histogram.
y = np.random.normal(2,3,10000)
h2d = eh.Hist2D((x,y),bins=200)
We can similarly plot the histogram.
fig,ax= plt.subplots(1,1,figsize=(12,6))
h2d.plot(ax,steps=True,ebar=False,filled=True,xlabel='x (unit)',ylabel='y(unit)',title='Test',cbarlabel='Colorbar',aspect='auto',cmin=1)
There are a lot of othe nice useful features which can be found in the documentation.
Metadata
Release files for easyhist 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| easyhist-0.2.4.tar.gz | 8.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easyhist-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / easyhist-0.2.4.tar.gz
| Download URL | easyhist-0.2.4.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
389008455f38efa9ed3991898cb308d4564c9e2df698bf94d3163301c18c9c1d
|
|
BLAKE2b-256 checksum How to use checksums |
0f0acf43920fb3a39c359f814fbe38374981514c5b2a465c9e2b2ec129aa4af5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / easyhist-0.2.4-py3-none-any.whl
| Download URL | easyhist-0.2.4-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e162080925f3c13c627c1d7c11c8d4e51209e42acf93952806a302e0c0ba2ab
|
|
BLAKE2b-256 checksum How to use checksums |
49b9b8441e5999632800b595a27e8559c2d750fd7d248de9b7116726dc52c96b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for easyhist 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.