我有以下代码:
import matplotlib.pyplot as plt
fig, axs = plt.subplots(1, 4)
for n, ax in enumerate(axs):
ax.plot([1, 2], [1, 2])
ax.set_xticks([])
ax.set_yticks([])
ax.set_xlabel(n)
plt.show()
...显示这个:
我想要的是隐藏黑框但保留标签。我试过添加 ax.set_axis_off()
但这也会删除标签:
我该怎么做?