hvplot — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited hvplot (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This document provides best practices for developing plots and charts with HoloViz hvPlot in notebooks and .py files.
Please develop as an Expert Python Developer developing advanced data-driven, analytics and testable data visualisations, dashboards and applications would do. Keep the code short, concise, documented, testable and professional.
Core dependencies provided with the hvplot Python package:
Optional dependencies from the HoloViz Ecosystem:
pip install hvplot hvsampledata panel watchfilesFor development in .py files DO always include watchfiles for Panel hotreload.
In the example below we will use the earthquakes sample data:
import hvsampledata
hvsampledata.earthquakes("pandas")Tabular record of earthquake events from the USGS Earthquake Catalog that provides detailed
information including parameters such as time, location as latitude/longitude coordinates
and place name, depth, and magnitude. The dataset contains 596 events.
Note: The columns `depth_class` and `mag_class` were created by categorizing numerical values from
the `depth` and `mag` columns in the original dataset using custom-defined binning:
Depth Classification
| depth | depth_class |
|-----------|--------------|
| Below 70 | Shallow |
| 70 - 300 | Intermediate |
| Above 300 | Deep |
Magnitude Classification
| mag | mag_class |
|-------------|-----------|
| 3.9 - <4.9 | Light |
| 4.9 - <5.9 | Moderate |
| 5.9 - <6.9 | Strong |
| 6.9 - <7.9 | Major |
Schema
------
| name | type | description |
|:------------|:-----------|:--------------------------------------------------------------------|
| time | datetime | UTC Time when the event occurred. |
| lat | float | Decimal degrees latitude. Negative values for southern latitudes. |
| lon | float | Decimal degrees longitude. Negative values for western longitudes |
| depth | float | Depth of the event in kilometers. |
| depth_class | category | The depth category derived from the depth column. |
| mag | float | The magnitude for the event. |
| mag_class | category | The magnitude category derived from the mag column. |
| place | string | Textual description of named geographic region near to the event. |Below is a simple reference example for data exploration.
import hvsampledata
# DO import panel if working in .py files
import panel as pn
# Do importing hvplot.pandas to add .hvplot namespace to Pandas DataFrames and Series
import hvplot.pandas # noqa: F401
# DO always run pn.extension() to load panel javascript extensions
pn.extension()
# Do keep the extraction, transformation and plotting of data clearly separate
# Extract: earthquakes sample data
data = hvsampledata.earthquakes("pandas")
# Transform: Group by mag_class and count occurrences
mag_class_counts = data.groupby('mag_class').size().reset_index(name='counts')
# Plot: counts by mag_class
plot = mag_class_counts.hvplot.bar(x='mag_class', y='counts', title='Earthquake Counts by Magnitude Class')
# If working in notebook DO output to plot:
plot
# Else if working in .py file DO:
# DO provide a method to serve the app with `panel serve`
if pn.state.served:
# DO remember to add .servable to the panel components you want to serve with the app
pn.panel(plot, sizing_mode="stretch_both").servable()
# DON'T provide a `if __name__ == "__main__":` method to serve the app with `python`If working in a .py file DO always serve the plot with hotreload for manual testing while developing:
panel serve path/to/file.py --dev --showDONT serve with python path_to_this_file.py.
import hvplot.pandas # will add .hvplot namespace to Pandas dataframes
import hvplot.polars # will add .hvplot namespace to Polars dataframes
...from bokeh.models.formatters import NumeralTickFormatter
df.hvplot(
...,
yformatter=NumeralTickFormatter(format='0.00a'), # Format as 1.00M, 2.50M, etc.
)| Input | Format String | Output |
|---|---|---|
| 1230974 | '0.0a' | 1.2m |
| 1460 | '0 a' | 1 k |
| -104000 | '0a' | -104k |
When developing a hvplot please serve it for development using Panel:
import pandas as pd
import hvplot.pandas # noqa
import panel as pn
import numpy as np
np.random.seed(42)
dates = pd.date_range("2022-08-01", periods=30, freq="B")
open_prices = np.cumsum(np.random.normal(100, 2, size=len(dates)))
high_prices = open_prices + np.random.uniform(1, 5, size=len(dates))
low_prices = open_prices - np.random.uniform(1, 5, size=len(dates))
close_prices = open_prices + np.random.uniform(-3, 3, size=len(dates))
data = pd.DataFrame({
"open": open_prices.round(2),
"high": high_prices.round(2),
"low": low_prices.round(2),
"close": close_prices.round(2),
}, index=dates)
# Create a scatter plot of date vs close price
scatter_plot = data.hvplot.scatter(x="index", y="close", grid=True, title="Close Price Scatter Plot", xlabel="Date", ylabel="Close Price")
# Create a Panel app
app = pn.Column("# Close Price Scatter Plot", scatter_plot)
if pn.state.served:
app.servable()panel serve plot.py --devline - Line plots for time series and continuous data scatter - Scatter plots for exploring relationships between variables bar - Bar charts for categorical comparisons hist - Histograms for distribution analysis area - Area plots for stacked or filled visualizations
search (documentation), hvplot_list (available plot types), hvplot_get (docstrings and signatures), skill_get (best-practice skills).holoviz-mcp CLI is installed (also available as hv), use the equivalent CLI commands: holoviz-mcp search, holoviz-mcp hvplot list, holoviz-mcp hvplot get.streaming related information via https://hvplot.holoviz.org/en/docs/latest/search.html?q=streaming url.DO add tests to the tests folder and run them with pytest tests/path/to/test_file.py.
DO always start and keep running a development server panel serve path_to_file.py --dev --show with hot reload while developing!
--show flag, a browser tab will automatically open showing your app.--dev flag, the panel server and app will automatically reload if you change the code.--port {port-number} flag.--autoreload flagpython path_to_file.py to test or serve the app.pn.Column, pn.Tabs, pn.Accordion to layout multiple plots~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.