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

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:

主站蜘蛛池模板: 阳原县| 家居| 社旗县| 新巴尔虎左旗| 任丘市| 神农架林区| 尚义县| 揭阳市| 应用必备| 岳阳市| 耿马| 肥西县| 淅川县| 通海县| 大荔县| 文水县| 岢岚县| 沈阳市| 潼关县| 西昌市| 孝义市| 滨海县| 万安县| 进贤县| 平南县| 平南县| 重庆市| 凤冈县| 镇雄县| 合山市| 咸宁市| 清流县| 盱眙县| 咸丰县| 抚松县| 炉霍县| 炎陵县| 新河县| 乐至县| 元江| 汤原县|