01、加载库
importnumpy as npimportpandas as pdimport matplotlib.pyplot as plt
02、示例数据
x = np.linspace(-np.pi*2, np.pi*2)
y1=np.sin(x)
y2= np.power(x, 2) * 0.05 #指数运算
df = pd.DataFrame({'a': y1, 'b': y2}, index=x)
1、默认设置下的图形
fig =plt.figure()
df.plot()
plt.show()
2、设置坐标轴标签字体大小和颜色
fig =plt.figure()
df.plot()
plt.yticks(size=14, color='grey')
plt.xticks(size=14, color='grey')
plt.show()
3、更改竖轴刻度范围
fig =plt.figure()
df.plot()
plt.ylim(-2, 3)<