import holoviews as hv from holoviews import opts hv.extension("bokeh")★Load a backend first —"bokeh"(interactive, default),"matplotlib"(static/publication), or"plotly"(3-D).optsholds the option builders.hv.extension("bokeh", "matplotlib") # load several, switch laterRegister multiple backends; the first is active. Swap withhv.output(backend="matplotlib").pip install holoviews # or: conda install -c pyviz holoviewsIn a notebook, an element displays itself automatically. In scripts, usehv.save/hv.render(card 8).
hv.Curve(df, "time", "value") # line hv.Scatter(df, "x", "y") · hv.Points(df, ["x", "y"])★An Element wraps your data with meaning. Accepts pandas, arrays, dicts, xarray.Curve=continuous,Scatter=y-vs-x,Points=2-D positions.hv.Bars · hv.Histogram · hv.Area · hv.HeatMap · hv.BoxWhisker★The everyday chart vocabulary. AlsoDistribution,Violin,Spikes,Path,Segments,Sankey.hv.Image(arr) · hv.RGB(arr) · hv.QuadMesh · hv.ContoursGridded/raster elements — feed 2-D arrays or xarrayDataArrays (great with weather/imagery data).
hv.Curve(df, kdims="time", vdims="price")★The key idea:kdims= key/independent dims (the x you index by),vdims= value/dependent dims (the y measured). Positional args are(kdims, vdims)in that order.hv.Dimension("temp", label="Temperature", unit="°C", range=(0, 40))Rich dimensions carry a label, unit, and range — which drive axis titles, colorbars, and slider bounds automatically.curve.redim.label(price="Price (USD)").redim.range(price=(0, 500)).redimrelabels or re-ranges a dimension after the fact — without rebuilding the element.