plt.rc('font',family='Times New Roman')
plt.xticks(fontsize=10,color='blue',rotation=60)
plt.yticks(fontsize=10)
plt.xlim(0,100)
plt.ylim(10,20)
ax=plt.gca();
ax.spines['bottom'].set_linewidth(1);
ax.spines['left'].set_linewidth(1);
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
或者
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.xlabel('X')
plt.ylabel('Y')
xmajorLocator = MultipleLocator(10)
xmajorFormatter = FormatStrFormatter('%1.1f')
xminorLocator = MultipleLocator(1)
ymajorLocator = MultipleLocator(0.05) # 主刻度以0.05为单位
ymajorFormatter = FormatStrFormatter('%1.1f') # 精确到小数点后一位
yminorLocator = MultipleLocator(0.01) # 次刻度0.01为单位
ax=plt.gca()
ax.xaxis.set_major_locator(x_major_locator)
ax.xaxis.set_major_formatter(xmajorFormatter)
ax.xaxis.set_minor_locator(xminorLocator)
ax.yaxis.set_major_locator(y_major_locator)
ax.yaxis.set_major_formatter(ymajorFormatter)
ax.yaxis.set_minor_locator(yminorLocator)
#坐标轴的网格使用主刻度/次刻度设置
ax.xaxis.grid(True, which='major') # x主刻度
ax.yaxis.grid(True, which='minor') # y次刻度