Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the figure () function in python to draw two pictures

Shulou Source: shulou.com Published: 2022-05-31 17:49:19 10月02日 Update

This article mainly explains "how to use the figure () function in python to draw two pictures." interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to draw two pictures with the figure () function in python.

1. Description

In Python, Matplotlib is a mathematical extension of the digital-NumPy library. The Figure module provides the top-level Artist, or Figure, which contains all the drawing elements. This module is used to control the default spacing between the subgraphs of all elements and the top-level containers.

2. Examples

If you want to draw two pictures, you must use plt.figure () twice, you can specify num, or you can not specify num, and calling it twice will add 1 by default.

Import matplotlib.pyplot as pltx= [1Jing 2jue 3] y1 = [1je 2je 4] y2 = [1je 4je 8] plt.figure () plt.plot (xmemy1mcecolor = "red", label = "red") plt.legend () # if there is no such statement, it will not display the lower right corner label plt.figure () plt.plot (xjingy2color = "green", label = "green") plt.legend () # without this statement it will not show what labelplt.show () python can do in the upper right corner Python is a programming language Built-in many effective tools, Python almost omnipotent, the language is easy to understand, easy to start, powerful, in many fields, such as the most popular big data analysis, artificial intelligence, Web development and so on.

At this point, I believe you have a deeper understanding of "how to use the figure () function in python to draw two pictures". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Function content module statement language top level learning practical powerful deeper effective popular popular omnipotent that is artificial artificial intelligence elements interests functions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei Microsoft MySQL vpn