Vega-Lite Tutorial
Welcome to the tutorial on Vega-Lite - a declarative
visualization grammar! It provides a concise JSON syntax for
supporting quick creation of visualizations to support
analysis. You can read more about Vega-Lite at
vega.github.io/vega-lite.
Here, you will find videos explaining the features of
Vega-Lite, code walkthroughs for each feature and examples
of visualizations.
1. Introduction
-
1 Overview of Vega-Lite
Introducting Vega-Lite, a declarative visualization grammar that makes coding visualizations easier! This video compares imperative vs. declarative visualizations, motivate the use of Vega-Lite and the structure of the Vega stack.
References -
1.1 JSON and the online Vega Editor
Checking out the online editor and a brief overview of the Vega-Lite JSON schema
References
2. Data
-
2 Importing datasets into Vega-Lite
Overview of Vega-Lite's data model, how to import datasets, and how to generate data.
References
3. Transforms
-
3 Transforms Overview
Overview of transforms, how to declare them, and how to use the Vega Expression language.
References -
3.1 Sampling and Filtering transforms examples
Sampling "n" data points and filtering data using predicates (conditions).
References -
3.2 Calculate transform example
Adding a new attribute to your dataset, based on another attribute
References -
3.3 Aggregation transform example
Averages, standard deviations, sums - this transform lets you aggregate your data
References -
3.5 Binning transform example
Another form of aggregation, especially useful for histograms and heatmaps
References
4. Marks
-
4 Marks Overview
Overview of the mark object, how to declare them and their relation to encodings
References -
4.1 Point, Line and Bar Marks Examples
Examples for 3 mark types, and their specific encoding channels and properties
References -
4.2 Rule and Area marks
Overlaying rule marks on existing visualizations, and exploring area charts, stacked area charts and stream graphs
5. Encoding
-
5 Encodings Overview
Overview of encoding channels & channel definitions
References -
5.1 Scales - Overview & custom scales example
Overview of scales, domains and ranges. Plus an example in code to set custom scales
References -
5.2 Position Channels and Mark Property Encoding Channels Example
Coding examples for:
1) position ("x", "y") , and secondary position channels ("x2", "y2")
2) mark property channels - color, shape, size -
5.3 Time Units example
Different types of time-units, how Vega-Lite handles time-data and three ways of using time-units.
References
6. Params
-
6 Params Overview
How interaction in Vega-Lite is defined with 2 types of params (variable and selection), how to declare them and how to use them as predicates, in expressions strings and for data extents.
References -
6.1 Variable Parameters
Drop-downs, sliders, input elements - variable parameters and how to use them
-
6.2 Point Selections
Click and select individual or a group of data points
References -
6.3 Interval Selections
Drag and select to select data points in an interval, using a scatterplot matrix example.
References
7. View Composition
-
7 View Composition Overview
Overview of methods for combining multiple views, and one-sliders on the four methods.
References -
7.1 Layering Example
Layering one plot on top of the other
References -
7.2 Concatenation Example
Placing multiple independent plots next to each other
References -
7.3 Faceting Example
Repeating a visualization based on values of an attribute - especially useful for Trellis plots
References -
7.4 Repeating Views Example
Repeating a visualization based on different attributes
8. Config
9. Cross-cutting examples
-
9.1 Interactive Dashboard Example
Creating a dashboard based on the cars dataset with linking and brushing between histograms and a scatterplot.
-
9.2 Geovisualization in Vega-Lite - Examples
Topojsons, projections and geoviz in Vega-Lite with two examples.
-
9.3 Streaming Data Example with Vega-Lite API
Handling data that changes over time, using the Vega-Lite and Vega View APIs
References
10. Embedding Vega-Lite projects
-
10.1 Embedding Vega-Lite Specifications
Embedding Vega-Lite JSON into JavaScript, Python, Julia, R, and PowerBI
-
10.2 Altair - Using Vega-Lite with Python
Embedding Vega-Lite into python (jupyter) notebooks using the Altair API
References -
10.3 Vega-Lite API
Building visualizations in JavaScript using the Vega-Lite API
-
10.4 VegaLite.jl - Using Vega-Lite with Julia
Embedding Vega-Lite into Julia (jupyter) notebooks using the VegaLite.jl package.
References