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

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:

主站蜘蛛池模板: 铁岭市| 雷山县| 沙湾县| 上蔡县| 江西省| 松阳县| 南丹县| 乐至县| 三原县| 永城市| 凌源市| 札达县| 漳平市| 彩票| 伊宁县| 剑川县| 南漳县| 黔江区| 靖江市| 南投县| 靖西县| 丰县| 工布江达县| 沈丘县| 高雄县| 武义县| 淮滨县| 荔浦县| 乌鲁木齐市| 全椒县| 广安市| 彭阳县| 休宁县| 乌拉特后旗| 汉川市| 日土县| 新宾| 西藏| 泾源县| 南阳市| 耒阳市|