Skip to content

Commit

Permalink
docs: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Mar 17, 2021
1 parent b5ecb10 commit d15037c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Actions Status][actions-badge]][actions-link]
[![Documentation Status][rtd-badge]][rtd-link]
[![pre-commit.ci Status][pre-commit-badge]][pre-commit-link]
[![Code style: black][black-badge]][black-link]

[![PyPI version][pypi-version]][pypi-link]
Expand All @@ -10,7 +11,6 @@
[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
[![Gitter][gitter-badge]][gitter-link]
[![Scikit-HEP][sk-badge]](https://scikit-hep.org/)
[![pre-commit.ci status][pre-commit-badge]][pre-commit-link]


This is a package meant primarily for [documenting][rtd-link] histogram
Expand All @@ -20,16 +20,18 @@ used in type checking libraries wanting to conform to the protocol. Eventually,
it might gain a set of tools for testing conformance to UHI indexing, as well.
It is not usually a runtime dependency, but only a type checking, testing,
and/or docs dependency in support of other libraries (such as
[boost-histogram][], [hist][], [mplhep][], [uproot4][], and eventually
[histoprint][]). It requires Python 3.6+. [See what's
[boost-histogram][] 0.13+, [hist][] 2.1+, [mplhep][] 0.2.15+, [uproot][] 4+,
and [histoprint][] 2+). There are a few useful runtime usable components
(listed below). It requires Python 3.6+. [See what's
new](https://github.com/scikit-hep/uhi/releases).

To assist plotting libraries in accepting Histograms from classic sources, see
`uhi.numpy_plotting.ensure_plottable_histogram`, which will adapt NumPy style
`uhi.numpy_plottable.ensure_plottable_histogram`, which will adapt NumPy style
tuples into a simple PlottableHistogram.

The protocol provided do support runtime checking, so
`isinstance(h, uhi.typing.plotting.PlottableHistogram)` is valid at runtime.
The Protocols provided do support runtime checking, so
`isinstance(h, uhi.typing.plotting.PlottableHistogram)` is valid at runtime and
might be simpler than manually checking for the expected methods.

[actions-badge]: https://github.com/Scikit-HEP/uhi/workflows/CI/badge.svg
[actions-link]: https://github.com/Scikit-HEP/uhi/actions
Expand All @@ -53,5 +55,5 @@ The protocol provided do support runtime checking, so
[boost-histogram]: https://github.com/scikit-hep/boost-histogram
[hist]: https://github.com/scikit-hep/hist
[mplhep]: https://github.com/scikit-hep/mplhep
[uproot4]: https://github.com/scikit-hep/uproot4
[uproot]: https://github.com/scikit-hep/uproot4
[histoprint]: https://github.com/scikit-hep/histoprint
9 changes: 5 additions & 4 deletions docs/plotting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ Plotters should only depend on the methods and attributes listed below. In short

Axes have:

* ``ax[i]``: A sequence of lower, upper bin, or the discrete bin value (integer or sting)
* ``ax[i]``: A tuple of (lower, upper) bin, or the discrete bin value (integer or sting)
* ``len(ax)``: The number of bins
* Iteration is supported
* ``ax.traits.circular``: True if circular
* ``ax.traits.discrete``: True if the bin represents a single value (e.g. Integer or Category axes) instead of an interval (e.g. Regular or Variable axes)

Expand Down Expand Up @@ -69,16 +70,16 @@ Help for plotters

The module ``uhi.numpy_plottable`` has a utility to simplify the common use
case of accepting a PlottableProtocol or other common formats, primarily a
NumPy ``histogram/histogram2d/histogramdd`` tuple. The
NumPy ``histogram``/``histogram2d``/``histogramdd`` tuple. The
``ensure_plottable_histogram`` function will take a histogram or NumPy tuple,
or an object that implements ``.to_numpy`` or ``.numpy`` and convert it to a
or an object that implements ``.to_numpy()`` or ``.numpy()`` and convert it to a
``NumPyPlottableHistogram``, which is a minimal implementation of the Protocol.
By calling this function on your input, you can then write your plotting
function knowing that you always have a ``PlottableProtocol`` object, greatly
simplifying your code.


The full protocol version 1.1 follows:
The full protocol version 1.2 follows:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(Also available as ``uhi.typing.plottable.PlottableProtocol``, for use in tests, etc.
Expand Down

0 comments on commit d15037c

Please sign in to comment.