导包
import numpy as np
import matplotlib.pyplot as plt
代码
网格线图
ypoints = np.array([1,3,9,25,12,32,5,1])
数据插入到图表
marker:符号
color:颜色,可简写为c
linewidth:线条宽度
#plt.plot(ypoints,'o:g')
#plt.plot(ypoints,marker='o',linestyle=':',color='g')
plt.plot(ypoints,marker='o',ls=':',c='g',linewidth='1.5')
marker可以定义的符号如下:
散点图
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",