Python Data Visualization Transcripts
Chapter: Altair
Lecture: Shorthand API

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Before we go through examples of developing altair plots. I want to describe the API. There are two versions of the
0:07 API. There's a shorthand and a longer version. We'll start with the short and simple version. Both of them start with importing altair as
0:16 ALT. This is the code to show displacement versus fuel costs for the
0:22 data frame. We've been working with, each altair plot starts with a chart object which
0:27 is the foundation and you define which data frame you want to plot. Then you use the mark options to indicate what type of plot.
0:37 In this case I want to plot circles but you could do bar charts, lines, area plots or geographic images.
0:44 There are many different options. The next step is to encode your data frame to
0:51 the visual channels and what that means is you want to tell in this case the X and Y axis which columns to use in your data frame.
1:00 But you can also use those columns to inform the size the shape, the color, maybe add some text or alternative X and Y axes.
1:10 This basic structure allows a lot of flexibility for visualization and I encourage you to keep
1:17 this quick reference sheet handy as we go through the visualization so you can start to see how you can use for your own data visualization.

Talk Python's Mastodon Michael Kennedy's Mastodon