Traditional Plots
2.1. Traditional Plots#
Learning Outcome
Students will be able to classify and summarize data using traditional plots.
Sample Tasks:
Before undertaking any activity, students must answer the following questions:
What are you trying to show?
Does a trendline, heat map, time series, etc. make sense in this case?
Why will one type of graph work better than another?
Emphasize that the data and analysis must tell the story, and the charts are a helpful tool to tell the story.
State with clarity what you are trying to say.
Our first reading, from Computational and Inferential Thinking [ADW21], shows how to do traditional scatter plot and line graphs using the Table
class in the datascience
library.
-
Initial material on Scatter Plots and Line Graphs
Reading Questions
Would it make sense to do
actors.plot('Number of Movies', 'Total Gross')
?Can you overlay a scatter plot on a line graph?
Our second set of readings, from Learning Data Science [LGN23], walks through examples that use plots to try to understand data. It runs through examples of several different types of plots and discusses which are appropriate for which purposes.
Reading Questions
What is the coolest type of plot in these readings?
When should you apply a logarithm transform before plotting?
Further Resource: Plotting via Matplotlib
These readings, from the Python Data Science Handbook [Van16], explain how to plot using the matplotlib
library.
Matplotlib is a (the?) standard plotting library in python.
Typically you load it in a python session with
import matplotlib.pyplot as plt
The plotting in pandas
is built on top of matplotlib
.
Reading Question
How do you set a label for the y-axis on a plot?
Further Resource: Plotting via Seaborn
Seaborn is a plotting library built on top of matplotlib
to automatically give nice plots for statistical data in pandas dataframes.
Typically you load it in a python session with
import seaborn as sns