官术网_书友最值得收藏!

Matplotlib

As you know, visualization plays a huge role in gaining insights from data, and is also very important in machine learning. Matplotlib is a visualization library used for plotting by data scientists. You can get a clearer understanding by visiting its official website at https://matplotlib.org:

To install it on an Ubuntu machine, use the following command:

sudo apt-get install python3-matplotlib

To import the required packages, use import:

import matplotlib.pyplot as plt
import numpy as np

Use this example to prepare the data:

x = np.linspace(0, 20, 50)

To plot it, add this line:

plt.plot(x, x, label='linear')

To add a legend, use the following:

plt.legend()

Now, let's show the plot:

plt.show()

Voila! This is our plot:

主站蜘蛛池模板: 九台市| 客服| 桃园县| 印江| 肥东县| 宝清县| 邯郸县| 乃东县| 偃师市| 南漳县| 竹山县| 茂名市| 濮阳市| 汉源县| 容城县| 金塔县| 黄石市| 鸡东县| 龙山县| 襄汾县| 建水县| 安达市| 四川省| 呼和浩特市| 萨嘎县| 奉化市| 浏阳市| 邯郸市| 山西省| 四平市| 讷河市| 郓城县| 惠来县| 英德市| 刚察县| 宁夏| 万年县| 应城市| 闻喜县| 武鸣县| 宜丰县|