Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating a Canvas | Matplotlib Introduction
Ultimate Visualization with Python
course content

Contenido del Curso

Ultimate Visualization with Python

Ultimate Visualization with Python

1. Matplotlib Introduction
2. Creating Commonly Used Plots
3. Plots Customization
4. More Statistical Plots
5. Plotting with Seaborn

bookCreating a Canvas

First of all, matplotlib consists of three layers:

  • Backend layer (renders plot to screens or files);
  • Artist layer (describes how data is arranged, is made up of one object, Artist);
  • Scripting layer (connects the previous two layers and simplifies access to them).

We will mainly focus on the scripting layer with the pyplot module you have already seen and the artist layer. Artist layer contains the following:

  • Containers (e.g. Figure, Axes);
  • Primitives (e.g. Line, Rectangle, Circle, Text, etc).

Figure is the main Artist object and can be thought of as a canvas where all the plots will be located. Basically, it holds everything together.

On the other hand, Axes is an object made up of two axis objects, x-axis and y-axis.

Note

Figure = canvas, Axes = x-axis + y-axis.

Now let’s look at the creation of the Figure and its Axes:

1234
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot() plt.show()
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 3
some-alt