Skip to content
Tactiverge

Learning Rooms/○ Level 3 · Innovator/Mathematics

Matplotlib Tutorial (Part 1): Creating and Customizing Our First Plots

Corey Schafer · Length: see YouTube · captions on YouTube · nothing loads until you press play

By the end you can…

  • Match a plot type (line, scatter, histogram, bar) to the question being asked.
  • Label a plot fully: quantity, unit, title and data source.
  • Write matplotlib code that produces a labelled line plot.
?Predict▶Watch✓Practise⚙Build

Watch it all: no segment has been checked by hand for this video yet.

1.Predict before you press play

You want to see how a motor's temperature changed during a 30-minute test. Which plot?

Pick one before you press play. A wrong guess is fine: it is what makes the video stick.

2.See the idea first

Play with this diagram for a minute. It gives you something to hang the video on.

Loading the interactive…

Can't use the diagram? Read a description instead

The chart critique shows monthly conveyor jams as bars or as a line. A line shows the change across the year most clearly; bars from zero make the before and after levels easy to compare; error bars show the day-to-day spread so the size of the change can be judged against it.

3.Watch, actively

Makes and labels a first line plot in Python, including titles, axis labels and legends.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

Watch for…

  • → Watch how the axis labels, title and legend are added: those lines are what turn a picture into evidence.

Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.

Can't stream it? Read the idea instead

A plot should answer a question. In Python's Matplotlib you draw lines from lists of x and y values, then add a title, axis labels with units and a legend. Without labels and units a chart cannot be read by anyone else, however tidy it looks.

What the video covers (our own note, written when we verified it): Makes and labels a first line plot in Python, including titles, axis labels and legends.

Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.

Read it instead

Jot down one thing that surprised you and one question you still have.

Private: saved only on this device, never sent to Tactiverge.

4.Practise what you just saw

These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.

Practice 1

How noisy is a gyro at rest? You have 5,000 readings. Which plot shows the spread best?

Practice 2

Which y-axis label is best?

Practice 3 · a fresh version every time

A log of motor temperature (°C) reads xs = [63, 66, 59, 62, 60, 54, 60]. What is the median, statistics.median(xs)? Give 2 decimal places.

Practice 4

Does a servo's current draw rise with the load on its arm? You have 40 (load, current) pairs. Which plot?

5.Try it yourself

No simulation models this idea yet. The lesson below has an interactive diagram instead.

6.Where engineers use it

Engineering test reports usually standardise their charts: time series with units on both axes, the same colours for the same sensor in every figure, and the number of samples in each caption.

From the applied view in the lesson Choose the plot that answers the question. Checked by automated tests only.

7.Build something with it

Follow-up project

Take a sensor log you have (or the motor test CSV from week 3). Write three questions about it and make one correctly chosen, fully labelled plot for each. Under each, write one sentence answering its question.

Where this video lives

In the course catalogue: CSE-320 Algorithms and numerical computation

The video is by Corey Schafer, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.