1 import numpy as np import matplotlib.pyplot as plt x = np.array([1,2,3,4,5,6,7,8]) y = np.array([1,4,9,16,7,11,23,18]) sizes =np.array([20,50,100,200,500,1000,60,90]) colors =np.array(["red","green","black","orange","purple","beige","cyan","magenta"])#图标颜色 #scatter方法将数据插入散点图 plt.scatter(x,y,s=sizes,c=colors) plt.title('scatter') plt.show()
2
import numpy as np import matplotlib.pyplot as plt #准备数据 ypoints=np.array([5,6,8,45,56,12,45,31,2,89]) ypoints2=np.array([5,6,8,45,56,12,45,31,2,89])*2 #数据放进图表 # plt.plot(ypoints,'o:g') # plt.plot(ypoints,marker='o',linestyle=':',color='g') plt.plot(ypoints,marker='o',ls=':',c='g',lin