Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report