Skip to main content
100%

Fork of Vega-Lite API Template

✓ Published0🌍 Public
OOdos Matthews
Last edited Sep 15, 2021
Created on Sep 15, 2021

This example demonstrates a scatter plot of U.S. city fuel efficiency data from the UCI Machine Learning Repository's Auto MPG dataset, encoding vehicle weight as point size and color by country of origin against highway miles per gallon and horsepower. The visualization uses the Vega-Lite grammar via the vega-lite-api JavaScript library, which wraps Vega-Lite specifications for programmatic chart construction. The code pulls CSV data using d3.csv, then renders the interactive SVG chart with tooltip support through vega-tooltip, customizing axis and label styling through a configuration object. The visualization is built with Vega 5 and Vega-Lite 4, running in a browser with automatic width and height fitting to the viewport.

AI-generated description

A visualization constructed using the vega-lite-api.

The data shown here comes from the UCI Machine Learning Repository: Auto MPG Data Set, via Gist: Scatter Plot with Menus.

MIT Licensed

Similar vizzes