
上QQ阅读APP看书,第一时间看更新
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:
