{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction to Data Visualization with Altair" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notebook to accompany article on PB Python.\n", "http://pbpython.com/altair-intro.html" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd\n", "from altair import Chart, X, Y, Axis, SortField" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read in the sample CSV file containing the MN 2014 capital budget" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "budget = pd.read_csv(\"https://github.com/chris1610/pbpython/raw/master/data/mn-budget-detail-2014.csv\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | category | \n", "detail | \n", "amount | \n", "
---|---|---|---|
0 | \n", "UNIVERSITY OF MINNESOTA | \n", "Higher Education Asset Preservation (HEAPR) 1 | \n", "42500000 | \n", "
1 | \n", "UNIVERSITY OF MINNESOTA | \n", "Minneapolis; Tate Laboratory Renovation | \n", "56700000 | \n", "
2 | \n", "UNIVERSITY OF MINNESOTA | \n", "Crookston; Wellness Center | \n", "10000000 | \n", "
3 | \n", "UNIVERSITY OF MINNESOTA | \n", "Research Laboratories | \n", "8667000 | \n", "
4 | \n", "UNIVERSITY OF MINNESOTA | \n", "Duluth; Chemical Sciences and Advanced Materia... | \n", "1500000 | \n", "