Note
Go to the end to download the full example code.
Horizontal bar chart
xerr draws error bars on the value axis, centered at each bar’s own
right edge – the horizontal-bar counterpart of bar’s own yerr.

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.
View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.
View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.
import numpy as np
import plotpress
y = np.arange(6)
fig, ax = plotpress.subplots()
ax.barh(y, [3, 7, 2, 5, 8, 4], xerr=[0.4, 0.9, 0.3, 0.6, 1.1, 0.5],
color="#2ca02c", capsize=4)
ax.set_yticks(y); ax.set_title("barh"); ax.set_xlabel("value")
fig.tight_layout()
Total running time of the script: (0 minutes 0.106 seconds)