如何从下面的示例中删除xtick和ytick

2024-06-26 01:56:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在看下面这个寄生虫轴的例子 https://matplotlib.org/2.0.2/examples/axes_grid/demo_parasite_axes2.html

如何从该示例中删除xtick和ytick

我知道plt.tick_params,但这对我来说不起作用。 i、 我试过了

plt.tick_params(axis='x',which='both',bottom=False,top=False)

但这不起作用。 有人能帮忙吗


Tags: httpsorgfalsematplotlibdemopltparamsexamples
2条回答

如果此图是您试图实现的: enter image description here

将这些行添加到代码中:

host.set_xticks([])
host.set_yticks([])

IIUC,我相信你可以使用tick_params(width=0)。根据需要调整下面的标记,具体取决于要隐藏的标记

host.tick_params(width=0)
par1.tick_params(width=0)
par2.tick_params(width=0)

输出:

enter image description here

相关问题 更多 >