【发布时间】:2019-03-28 22:37:22
【问题描述】:
我正在尝试绘制像here 这样的笛卡尔坐标轴:
由于 yticks 重叠,我想减少它们的数量。我尝试了this 方法。
for n, label in enumerate(ax.axis[direction].get_ticklabels()):
if n % 5 != 0:
label.set_visible(False)
但它给出了一个错误:
'AxisArtist' object has no attribute 'get_ticklabels'
我该如何克服它?
【问题讨论】:
-
一般来说,查看当前版本的示例,而不是旧版本。例如。 the spine placement,或axisline style。对于滴答声,请考虑使用tick-locators 中的定位器,例如
MultipleLocator或MaxNLocator。
标签: python matplotlib axis axis-labels