Skip to main content

hedron-charts

PyPI Python CI License: MIT

First-party charts, deterministic exports, and optional plotting-library adapters for Hedron.

Beginner LineChart / BarChart / AreaChart / ScatterChart, Matplotlib static SVG/PNG, Plotly interactive JSON, and Altair/Vega-Lite specifications.

Package maturity: Stable · Package line: 1.0.x · requires hedron-core>=1.0.0,<2.0

Interactive Plotly/Vega full browser runtimes remain experimental: Hedron ships host shims that fail closed when window.Plotly / window.vegaEmbed are missing. Applications may supply pinned local runtimes; first-party offline runtime pins exist for Experimental interactive hosts and are not Supported production Auto defaults.

Phase 0.38 first-party charts

Phase 0.38 ships hedron-charts 0.2.0 with schema-driven ChartSpec / ChartPlan, an ABI-conforming hedron-chart Web Component, semantic server fallbacks, SVG by default, Canvas for dense series, core inspect/focus/select/reset events, deterministic server exports, and bounded payloads. The current host has dedicated paint behavior for line, area, bar, and point; broader schema acceptance does not imply a specialized painter. Matplotlib remains Supported; Plotly/Altair stay Experimental. See RFC-0069 and the phase 0.38 acceptance packet.

Install

# flagship extra:
pip install "hedron[charts]>=1.0.0"
# independent satellite:
pip install "hedron-charts>=1.0.0,<2.0"
# Add a backend when needed:
pip install "hedron-charts[matplotlib]>=1.0.0,<2.0"

For applications, keep the flagship extra on the 1.0.x train; direct package consumers may use the Stable hedron-charts>=1.0.0,<2.0 SemVer range.

Optional backends

Extra Backend
matplotlib Matplotlib static SVG/PNG
plotly Plotly figure JSON
altair Altair / Vega-Lite (+ vl-convert)
pydeck / folium Map layers
graphviz / networkx Graph layouts
bokeh / holoviews / pygal / datashader / great_tables Additional adapters
all Union of the above

Backend extras are optional and should be installed only for the adapter in use.

Choose an entry point

Need Use Runtime
A line, area, bar, or scatter chart from row mappings LineChart, AreaChart, BarChart, ScatterChart First-party hedron-chart; useful server fallback without JavaScript
A validated declarative specification Chart + ChartSpec First-party hedron-chart
A server-rendered Matplotlib figure MatplotlibChart Static SVG or PNG; no browser plotting runtime
An existing Plotly or Altair figure PlotlyChart / AltairChart Vendored browser runtime; Experimental explicit opt-in

The beginner components do not select Matplotlib automatically. They compile to the first-party ChartSpec / ChartPlan path.

Quick start

from hedron_charts import LineChart

chart = LineChart(
    [{"month": "Jan", "revenue": 10}, {"month": "Feb", "revenue": 14}],
    x="month",
    y="revenue",
    title="Monthly revenue",
    description="Revenue increased during the period.",
)

The response contains a semantic figure, summary, and bounded table fallback. The local hedron-chart module progressively enhances it to SVG or Canvas and remounts after HTMX swaps.

For an explicit Matplotlib figure:

import matplotlib.pyplot as plt
from hedron_charts import MatplotlibChart

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
chart = MatplotlibChart(fig, alt="y = x squared", description="Quadratic growth")

Advanced specification and export

from hedron_charts import Chart, compile_chart, export_csv, parse_chart_spec

spec = parse_chart_spec(
    {
        "data": {
            "rows": [
                {"month": "Jan", "revenue": 10},
                {"month": "Feb", "revenue": 14},
            ]
        },
        "marks": [
            {
                "type": "line",
                "encodings": {
                    "x": {"field": "month", "type": "string"},
                    "y": {"field": "revenue", "type": "number"},
                },
            }
        ],
        "accessibility": {
            "title": "Monthly revenue",
            "description": "Revenue increased from January to February.",
        },
    }
)

chart = Chart(spec)
plan = compile_chart(spec)
csv_text = export_csv(plan, authorized=user_can_export)

Unknown schema fields, mark types, encoding channels, scales, and transform operators fail closed with HED-CHART-* diagnostics. Perform export authorization in application code; the default authorized=True argument is intended for already-authorized internal calls.

The compiler also accepts advanced mark families, guide metadata, and interaction flags that the 0.2.0 browser host does not yet paint or operate with dedicated behavior. Review the runtime coverage matrix before choosing the first-party host for advanced visualizations.

License

MIT. See the repository license.

Metadata

Release files for hedron-charts 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hedron-charts 1.3.0
File Size Uploaded Provenance Actions
hedron_charts-1.3.0.tar.gz 2.9 MB Without provenance Details for hedron_charts-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hedron-charts 1.3.0
File Interpreter ABI Platform Actions
hedron_charts-1.3.0-py3-none-any.whl Python 3 none any Details for hedron_charts-1.3.0-py3-none-any.whl

Total release size: 5.9 MB

Release files / hedron_charts-1.3.0.tar.gz

Download URL hedron_charts-1.3.0.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
7ce34c2c1f4c3c493b4b37cc5ad9abcf6d646d46ac4c3a16d8589ecaa18128f2
BLAKE2b-256 checksum
How to use checksums
0535815beb7cd124946c1dba1712f7c7ada4cd55c560f8fddc7f62e449a34239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hedron_charts-1.3.0-py3-none-any.whl

Download URL hedron_charts-1.3.0-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
131d924754f5028f372b152ea782662c8e8a3f5de6d5ee081e8f9b717fb9e9e4
BLAKE2b-256 checksum
How to use checksums
840bc378187192f00af6bfe864060bd7b08f7ae97bd90aaf31c6af8df1dd87f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for hedron-charts 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page