Lecture 24 – Introduction to Visualization

Data 94, Spring 2021

In [1]:
from datascience import *
import numpy as np
import seaborn as sns

Table.interactive_plots()

What is visualization?

In [2]:
# Run this cell.
full_titanic = Table.from_df(sns.load_dataset('titanic').dropna())
titanic = full_titanic.select('sex', 'age', 'fare')
titanic
Out[2]:
sex age fare
female 38 71.2833
female 35 53.1
male 54 51.8625
female 4 16.7
female 58 26.55
male 34 13
male 28 35.5
male 19 263
female 49 76.7292
male 65 61.9792

... (172 rows omitted)

Visualizations are for humans!

In [3]:
titanic.select('age', 'fare').scatter('age', 'fare', 
                width = 500, 
                height = 500,
                title = 'Fare vs. age for Titanic passengers',
                show = False)