import numpy as np import holoviews as hv hv.extension('matplotlib')
provide a visual indicator for the variability of the plotted data on a graph. They are usually applied on top of other plots such as scatter, curve or bar plots to indicate the variability in each sample.
may be used to represent symmetric error or assymetric error. An
Element must have one key dimensions representing the samples along the x-axis and two or three value dimensions representing the value of the sample and positive and negative error values associated with that sample. See the
Columnar Data Tutorial
for supported data formats, which include arrays, pandas dataframes and dictionaries of arrays.
Symmetric error ¶
By default the
Element accepts x- and y-coordinates along with a symmetric error value:
np.random.seed(7) errors = [(0.1*i, np.sin(0.1*i), np.random.rand()/2) for i in np.linspace(0, 100, 11)] hv.Curve(errors) * hv.ErrorBars(errors)
is a set of x-/y-coordinates with associated error values. Error values may be either symmetric or asymmetric, and thus can be supplied as an Nx3 or Nx4 array (or any of the alternative constructors Chart Elements allow).
errors = [(0.1*i, np.sin(0.1*i), np.random.rand()/2, np.random.rand()/4) for i in np.linspace(0, 100, 11)] hv.Curve(errors) * hv.ErrorBars(errors, vdims=['y', 'yerrneg', 'yerrpos'])