{"id":4036,"library":"histoprint","title":"histoprint","description":"histoprint is a Python library that provides pretty-printing of NumPy (and other compatible) histograms directly to the console. It leverages terminal color codes and Unicode characters to create visually appealing histogram representations. Currently at version 2.6.0, it follows a regular release cadence with updates typically adding features, improving compatibility, and addressing minor issues.","status":"active","version":"2.6.0","language":"en","source_language":"en","source_url":"https://github.com/scikit-hep/histoprint","tags":["histogram","console","cli","scikit-hep","data-visualization","numpy"],"install":[{"cmd":"pip install histoprint","lang":"bash","label":"Standard Install"},{"cmd":"pip install histoprint[uproot]","lang":"bash","label":"With Uproot support"},{"cmd":"pip install histoprint[rich]","lang":"bash","label":"With Rich integration"}],"dependencies":[{"reason":"Core functionality relies on NumPy arrays for histogram data.","package":"numpy","optional":false},{"reason":"Optional dependency for plotting ROOT files via the CLI and PlottableProtocol-like histograms.","package":"uproot","optional":true},{"reason":"Optional dependency for enhanced console output, particularly for RichHistogram class.","package":"rich","optional":true}],"imports":[{"symbol":"text_hist","correct":"from histoprint import text_hist"},{"symbol":"print_hist","correct":"from histoprint import print_hist"}],"quickstart":{"code":"import numpy as np\nfrom histoprint import text_hist, print_hist\n\n# Create some sample data\nA = np.random.randn(1000) - 2\nB = np.random.randn(1000)\nC = np.random.randn(1000) + 2\n\n# Use text_hist for a single array (wraps numpy.histogram)\nprint('--- Single Histogram (text_hist) ---')\ntext_hist(B, bins=[-5, -3, -2, -1, -0.5, 0, 0.5, 1, 2, 3, 5], title=\"Variable bin widths\")\n\n# Create NumPy histograms manually for print_hist\nhistA = np.histogram(A, bins=15, range=(-5, 5))\nhistB = np.histogram(B, bins=15, range=(-5, 5))\nhistC = np.histogram(C, bins=15, range=(-5, 5))\n\n# print_hist can print multiple histograms at once\nprint('\\n--- Overlapping Histograms (print_hist) ---')\nprint_hist(([histA[0], histB[0], histC[0]], histA[1]), title=\"Overlays\", labels=\"ABC\")\n\nprint('\\n--- Stacked Histograms (print_hist) ---')\nprint_hist(([histA[0], histB[0], histC[0]], histA[1]), title=\"Stacks\", stack=True, labels=\"ABC\", bg_colors=\"rgb\")","lang":"python","description":"This quickstart demonstrates how to generate sample data using NumPy and then visualize it as histograms in the console using `histoprint.text_hist` for single-array input and `histoprint.print_hist` for displaying multiple or pre-computed NumPy histograms, including stacked visualizations."},"warnings":[{"fix":"Upgrade your Python environment to 3.8 or later.","message":"Version 2.0.0 dropped support for Python 2.7 and Python 3.5. Ensure your environment uses Python 3.6 or newer (Python 3.8+ recommended for v2.6.0+).","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Change install command from `histoprint[root]` to `histoprint[uproot]`.","message":"The optional extra dependency 'root' was renamed to 'uproot' in version 2.3.0. If you were installing with `pip install histoprint[root]`, you must now use `pip install histoprint[uproot]`.","severity":"breaking","affected_versions":">=2.3.0"},{"fix":"Ensure your Python environment is version 3.8 or higher.","message":"Version 2.6.0 and later explicitly require Python 3.8+. Previous versions supported Python 3.6+.","severity":"breaking","affected_versions":">=2.6.0"},{"fix":"Consult histoprint documentation for options to disable or limit Unicode combining characters, such as `symbols` argument in `print_hist` or specific configuration settings if available.","message":"Some terminals may not correctly display Unicode combining characters used by histoprint for overlaying histograms. If output appears garbled, you may need to constrain the character set.","severity":"gotcha","affected_versions":"All"},{"fix":"Always pass pre-computed histogram data (counts and bin edges) to `print_hist` or ensure the object adheres to the `PlottableProtocol`.","message":"While `text_hist` accepts raw data, `print_hist` expects a tuple of `(counts, bin_edges)` similar to the output of `numpy.histogram` or a compatible `PlottableHistogram` object (e.g., from `boost-histogram` or `Hist` library).","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}