for_bar#

Hist1d.for_bar()[source]#

Return arrays appropriate for plotting with plt.bar.

Attention

When using for_bar, you cannot provide the widths keyword in plt.bar!

Returns:
centersndarray
valuesndarray
binwidthsndarray

See also

for_plot
for_step

Examples

Plot hist: Hist1d:

plt.bar(*hist.for_bar())

Note that you cannot provide the widths keyword when using this:

plt.bar(*hist.for_bar(), widths=widths) # invalid!!!

If you want to provide your own binwidths, use Hist1d.for_plot() instead:

plt.bar(*hist.for_plot(), widths=widths)