# 点状样式
fig = plt.figure()
x = np.linspace(0,10,20)
plt.plot(x, np.sin(x),'o')
plt.show()
fig.savefig('C:/Users/Administrator/sino.png')
# color 控制颜色
fig = plt.figure()
x = np.linspace(0,10,20)
plt.plot(x, np.sin(x),'o',color='red')
plt.show()
fig.savefig('C:/Users/Administrator/sincolor.png')
、
# 加label
x = np.linspace(0,10,80)
y = np.sin(x)
fig = plt.figure()
plt.plot(x,y,'--',label='sinx')
plt.plot(x, np.cos(x),'o',label='cosx')
plt.legend(loc='upper right')
plt.show()
fig.savefig('C:/Users/Administrator/sclabel.png')
# .legend控制label的显示效果,loc是控制label的位置的显示
# plt.legent? 遇到不熟悉函数时,使用? 查看函数的文档
plt.plot? #查询样式信息
# plot 函数,可定制的函数非常多
x = np.linspace(0,10,20)
y = np.sin(x)
fig = plt.figure()
#样式 -p 五边形 -D 四边形 -h 六边形
plt.plot(x,y,'-p',color='green', linewidth = 4, markersize=14, markeredgecolor='orange', markeredgewidth=1)
plt.show()
fig.savefig('C:/Users/Administrator/markersize.png')
# xlim ylim限定范围
x = np.linspace(0,10,20)
y = np.sin(x)
fig = plt.figure()
# -p 五边形 -D 四边形 -h 六边形
plt.plot(x,y,'-p',color='green', linewidth = 2, markersize=14, markeredgecolor='orange', markeredgewidth=1)
plt.ylim(-0.5, 0.8);
plt.xlim(2,8)
plt.show()
fig.savefig('C:/Users/Administrator/scale.png')
# 散点图
plt.scatter(x,y, s=50) #s 控制点的大小
plt.show()