Axes 对象设置:
ax.set_title 设置图形的标题;
ax.set_xticks 设置 X 轴的刻度,其中 minor=True 参数表示设置更小的刻度;
ax.set_yticks 设置 Y 轴的刻度;
ax.set_xlabel 设置 X 轴的标签;
ax.set_ylabel 设置 Y 轴的标签;
ax.grid 开启图形的刻度网格,其中 minor=True 参数表示显示小刻度的网格;
ax.text 为图形添加文字,前两个参数表示添加的文字在坐标系中的位置;
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 1,100)
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.set_title("shiyanlou")
ax.plot(x, x ** (1/8), 'b--', label=r'$y = x^{1/8}$')
ax.plot(x, x ** 8, 'r--', label=r'$y = x^{8}$')
ax.p