course content

Course Content

Visualization in Python with matplotlib

Creating an Empty PlotCreating an Empty Plot

Welcome to the course! In this course, we will learn the matplotlib library, probably, one of the most popular visualization tools for Python. Within the course, we will focus on pyplot - state-based interface to matplotlib.

Common practice is using the plt alias for matplotlib.pyplot. This is not compulsory, but widely used by Python community, so I recommend you to follow this rule.

The basic concept of building plots in matplotlib is using two objects: Figure as a space for building your graph and Axes - an area where points can be specified (usually in terms of x-y coordinates, but also in a 3D plot, for example, and so on).

To create both Figure and Axes objects, you can use the .subplots() function from matplotlib.pyplot using multiple assignment (we need to create two variables: for Figure and Axes objects). That's why using an alias is a good practice. Finally, after assigning Figure and Axes objects to certain variables, we can initialize an empty plot by applying the .plot() function to the Axes object. Finally, we use to display the plot.

Everything was clear?

Section 1. Chapter 1