使用matplotlib绘制第一张图

如下是博主使用matplotlib学习绘制的一张图:

import matplotlib.pyplot as plt

x = [1, 2, 3, 4]    # prepare data
y = [10, 20, 25, 30] # prepare data
flg = plt.figure()  # create plot
ax = flg.add_subplot(111)  # plot
ax.plot(x, y, color='lightblue', linewidth=3) # plot and customize plot
ax.scatter([2, 4, 6],[5, 15, 25], color='darkgreen', marker='^')    # plot with scatter
ax.set_xlim(1, 6.5) # limit the x axis
plt.show()  # show plot

 

使用matplotlib绘制第一张图_第1张图片

 

你可能感兴趣的:(work,summary,machine,learning,python,matplotlib,python,ML,机器学习)