VegaFusion

2.0.3 · active · verified Wed Apr 15

VegaFusion provides server-side acceleration for the Vega visualization grammar, primarily designed to enhance Python libraries like Altair. It enables scaling interactive charts to large datasets by offloading data transformations from the browser to an efficient, multi-threaded Rust-based Python kernel. The library is currently at version 2.0.3 and maintains an active development and release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to enable VegaFusion for Altair visualizations. As of VegaFusion 2.0, the integration is handled by enabling Altair's built-in 'vegafusion' data transformer. This allows Altair charts to automatically offload data-intensive operations to the VegaFusion backend.

import altair as alt
from vega_datasets import data

# Enable the VegaFusion data transformer within Altair
alt.data_transformers.enable('vegafusion')

# Example Altair chart that benefits from VegaFusion's server-side processing
source = data.flights.url

chart = alt.Chart(source).mark_bar().encode(
    x=alt.X('distance:Q', bin=True),
    y='count()'
).properties(title='Flight Distance Histogram (Accelerated by VegaFusion)')

# To display the chart in a Jupyter environment:
chart

# To save the chart with transformed data (using Altair's native save method):
# chart.save('flight_histogram.json')

view raw JSON →