HoloViews
HoloViews is a high-level, declarative plotting API for the PyData ecosystem, providing a concise way to build complex, interactive visualizations. It works seamlessly with data structures from libraries like NumPy, Pandas, Xarray, Dask, and Narwhals, and can render plots using Bokeh, Matplotlib, or Plotly backends. The library maintains an active development pace with frequent patch and minor releases, typically every few weeks or months, ensuring broad compatibility and continuous feature enhancements.
Warnings
- gotcha Always call `hv.extension()` with your desired backend (e.g., 'bokeh', 'matplotlib', 'plotly') at the start of your notebook or script to initialize the plotting system. Without it, plots will not render.
- gotcha HoloViews requires at least one plotting backend library (e.g., Bokeh, Matplotlib, Plotly) to be installed to render plots. Installing `holoviews` alone is often not enough.
- breaking HoloViews v1.21.0 and newer require Python 3.10 or later. Older Python versions are no longer supported.
- gotcha For optimal performance with very large datasets, consider using HoloViews with `datashader`. Datashader can efficiently render millions or billions of points into a fixed-size raster image, preventing browser slowdowns.
- compatibility HoloViews versions prior to 1.22.1 may have compatibility issues with Pandas 3.0. While efforts are made for forward compatibility, using an older HoloViews with a newer Pandas might lead to unexpected behavior.
Install
-
pip install holoviews -
pip install holoviews[bokeh] -
pip install holoviews[all]
Imports
- holoviews
import holoviews as hv
Quickstart
import holoviews as hv
import numpy as np
hv.extension('bokeh')
# Create some sample data
xs = np.linspace(0, 2 * np.pi, 100)
ys = np.sin(xs)
# Create a Curve Element
curve = hv.Curve((xs, ys), 'x', 'y', label='Sine Wave')
# Display the plot (in a Jupyter environment)
curve