Python | Matplotlib中的Pyplot

matplotlib.pyplot provides a number of different functions that can be used to plot and visualize our data. It also gives a free hand to do different operations with a plot such as annotations, marking, etc. In this article, we are going to learn a very basic plot type and how to label its axis and furthermore will add the Figure title.

matplotlib.pyplot提供了许多不同的功能,可用于绘制和可视化我们的数据。 它还使您可以自由地对图形进行不同的操作,例如注释,标记等。在本文中,我们将学习一种非常基本的图形类型以及如何标注其坐标轴,此外还将添加Figure标题。

Pyplot in Matplotlib (1)

Plotting using a single array automatically puts it on the y-axis. So adding two arrays in order (x-axis, y-axis) can produce our desired plot. One example is shown in figure 2.

使用单个数组进行绘图会自动将其放置在y轴上。 因此,按顺序添加两个数组(x轴,y轴)可以生成我们想要的图。 图2显示了一个示例。

Pyplot in Matplotlib (2)

Python代码演示Matplotlib中的Pyplot示例 (Python code to demonstrate example of Pyplot in Matplotlib)

# Data Visualization using Python
# Basics of Plotting

import matplotlib.pyplot as plt

# plotting using plt.pyplot()
plt.plot([4,7,3,6,1,8,9,2,3])

# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')

# figure name
plt.title('Plotting Basics')

##########################################

# plotting using plt.pyplot() Figure 2
plt.plot([1,7,3,6],[1,8,9,3])

# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')

# figure name
plt.title('Plotting Basics : Figure 2')


翻译自: https://www.includehelp.com/python/pyplot-in-matplotlib.aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值