【发布时间】:2016-01-27 18:19:24
【问题描述】:
有没有办法使用 matplotlibrc 或其他 matplotlib 配置方法来打开 xticks 和 yticks?我目前看到的唯一方法是将刻度和刻度标签的大小设置为零。这似乎是一种奇怪的方式,因为我可以set_xticks(())
【问题讨论】:
标签: python matplotlib plot
有没有办法使用 matplotlibrc 或其他 matplotlib 配置方法来打开 xticks 和 yticks?我目前看到的唯一方法是将刻度和刻度标签的大小设置为零。这似乎是一种奇怪的方式,因为我可以set_xticks(())
【问题讨论】:
标签: python matplotlib plot
您可以通过tick_params 做到这一点
plt.tick_params(axis='both', which='both')
这会影响both 轴(其他选项是x 或y)。它还会影响both 主要和次要刻度(其他选项是major 或minor)
这将在外边缘留下刻度,但不在图中。如果要删除边缘刻度,可以添加:
bottom='off'
top='off'
left='off'
right='off'
如果你想删除标签,你会想把这些off
labelbottom='off'
labeltop='off'
labelleft='off'
labelright='off'
【讨论】: