Basic Vega-Lite Example


In [1]:
import pandas as pd
df = pd.read_json('cars.json')

In [2]:
df.head()


Out[2]:
Acceleration Cylinders Displacement Horsepower Miles_per_Gallon Name Origin Weight_in_lbs Year
0 12.0 8 307.0 130.0 18.0 chevrolet chevelle malibu USA 3504 1970
1 11.5 8 350.0 165.0 15.0 buick skylark 320 USA 3693 1970
2 11.0 8 318.0 150.0 18.0 plymouth satellite USA 3436 1970
3 12.0 8 304.0 150.0 16.0 amc rebel sst USA 3433 1970
4 10.5 8 302.0 140.0 17.0 ford torino USA 3449 1970

In [3]:
from vega import VegaLite

In [6]:
VegaLite({
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "mark": "point",
  "encoding": {
    "y": {"type": "quantitative", "field": "Acceleration"},
    "x": {"type": "quantitative", "field": "Horsepower"}
  }
}, df)


Out[6]:

In [ ]: