您可以使用plt.axis(x,y,'text')
将数字添加到图形中,以将刻度标签有效地放置在所需的位置:
# Remove tick labels
ax.set_xticklabels('')
ax.set_yticklabels('')
# Add more visible tick labels with a slight offset
plt.text(0.05,0.05,'0')
plt.text(1.05,0.05,'1')
plt.text(0.05,1.05,'1')
plt.text(-0.95,0.05,'-1')
plt.text(0.05,-0.95,'-1')