{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Demo: Exploring the Cars Dataset\n", "\n", "We'll start this tutorial with a demo to whet your appetite for learning more. This section purposely moves quickly through many of the concepts (e.g. data, marks, encodings, aggregation, data types, selections, etc.)\n", "We will return to treat each of these in more depth later in the tutorial, so don't worry if it all seems to go a bit quickly!\n", "\n", "In the tutorial itself, this will be done from scratch in a blank notebook.\n", "However, for the sake of people who want to look back on what we did live, I'll do my best to reproduce the examples and the discussion here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Imports and Data\n", "\n", "We'll start with importing the [Altair package](http://altair-viz.github.io/):" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import altair as alt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we'll use the [vega_datasets package](https://github.com/altair-viz/vega_datasets), to load an example dataset:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Name | \n", "Miles_per_Gallon | \n", "Cylinders | \n", "Displacement | \n", "Horsepower | \n", "Weight_in_lbs | \n", "Acceleration | \n", "Year | \n", "Origin | \n", "
---|---|---|---|---|---|---|---|---|---|
0 | \n", "chevrolet chevelle malibu | \n", "18.0 | \n", "8 | \n", "307.0 | \n", "130.0 | \n", "3504 | \n", "12.0 | \n", "1970-01-01 | \n", "USA | \n", "
1 | \n", "buick skylark 320 | \n", "15.0 | \n", "8 | \n", "350.0 | \n", "165.0 | \n", "3693 | \n", "11.5 | \n", "1970-01-01 | \n", "USA | \n", "
2 | \n", "plymouth satellite | \n", "18.0 | \n", "8 | \n", "318.0 | \n", "150.0 | \n", "3436 | \n", "11.0 | \n", "1970-01-01 | \n", "USA | \n", "
3 | \n", "amc rebel sst | \n", "16.0 | \n", "8 | \n", "304.0 | \n", "150.0 | \n", "3433 | \n", "12.0 | \n", "1970-01-01 | \n", "USA | \n", "
4 | \n", "ford torino | \n", "17.0 | \n", "8 | \n", "302.0 | \n", "140.0 | \n", "3449 | \n", "10.5 | \n", "1970-01-01 | \n", "USA | \n", "