当前位置:网站首页>Use Matplotlib to draw the first figure

Use Matplotlib to draw the first figure

2022-06-21 14:26:00 Record brother

The following are used by bloggers matplotlib Learn to draw a picture :

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

 

 

原网站

版权声明
本文为[Record brother]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202221425206504.html