Welcome to the next step in our
In this lesson, we will…
- Use graph functions to make a bar chart, scatterplot, pie chart and histogram
- Use general functions to add error bars, subplots, and AB lines to our charts
Here’s a quick review of the five core plots we’re learning:
- line chart: shows continuous change, often used to measure change over time (covered in the Make A Line Chart lesson, not this lesson)
- bar chart: uses bar height to compare a measure between categorical variables
- scatterplot: uses position to show the relationship, or correlation, between two numeric values
- pie chart: shows us the breakdown of a whole into its parts
- histogram: shows how one kind of data is distributed
And a quick review of graph functions and general functions:
Graph functions create charts, like a bar chart or pie chart. Inside the parentheses of the function, we put arguments that are specific to each kind of chart: for example, what color and weight to make each line of a line chart, which x and y values to use in a scatterplot or bar chart, or how big to make the bins in a histogram.
Almost all the other changes we can make in matplotlib are done outside of the graph function.
General functions allow us to change general aspects of a graph, like its title, legend, or axis scaling and labels. We call these general functions because they apply to all kinds of charts: for example, a scatterplot title is not different from a bar chart title. In both cases, a title would be added to a graph using
plt.title() after the graph is made.