Зміст курсу
Ultimate Visualization with Python
Ultimate Visualization with Python
Creating 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
:
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot() plt.show()
Дякуємо за ваш відгук!