回答:
このtick_paramsメソッドは、このようなものに非常に役立ちます。このコードは、主目盛りと副目盛りをオフにし、x軸からラベルを削除します。
from matplotlib import pyplot as plt
plt.plot(range(10))
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom=False, # ticks along the bottom edge are off
top=False, # ticks along the top edge are off
labelbottom=False) # labels along the bottom edge are off
plt.show()
plt.savefig('plot')
plt.clf()

plt.tick_params(axis='both', which='both', bottom='off', top='off', labelbottom='off', right='off', left='off', labelleft='off')
axesも同じtick_params方法です。
matplotlib、あなたは交換する必要があります'on'とTrueして'off'とFalse。
OPが要求するものとは厳密には異なりますが、すべての軸線、目盛り、およびラベルを無効にする簡単な方法は、次のように呼び出すだけです。
plt.axis('off')
ax.axis('off')、既存のAxesインスタンス上にあります。
または、空のティック位置とラベルを次のように渡すことができます
# for matplotlib.pyplot
# ---------------------
plt.xticks([], [])
# for axis object
# ---------------
# from Anakhand May 5 at 13:08
# for major ticks
ax.set_xticks([])
# for minor ticks
ax.set_xticks([], minor=True)
ax、あなたが使用することができます:ax.set_xticks([], [])
ax.set_xticks([])、メジャーティック、ax.set_xticks([], minor=True)マイナーティックの場合。pyplotare plt.xticks([])およびと同等のものplt.xticks([], minor=True)。
ここに私がmatplotlibメーリングリストで見つけた代替ソリューションがあります:
import matplotlib.pylab as plt
x = range(1000)
ax = plt.axes()
ax.semilogx(x, x)
ax.xaxis.set_ticks_position('none')

John Vinyardによって提供されたソリューションよりも優れたシンプルなソリューションがあります。使用NullLocator:
import matplotlib.pyplot as plt
plt.plot(range(10))
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.show()
plt.savefig('plot')
お役に立てば幸いです。
axins.xaxis.set_major_locator(plt.NullLocator())と、axinsはaxins = zoomed_inset_axes()(からインポートされた関数mpl_toolkits.axes_grid1.inset_locator)によって返されたオブジェクトです。
このスニペットは、xticksのみを削除するのに役立ちます。
from matplotlib import pyplot as plt
plt.xticks([])
このスニペットは、xticksとyticksの両方を削除するのに役立ちます。
from matplotlib import pyplot as plt
plt.xticks([]),plt.yticks([])
# remove all the ticks (both axes), and tick labels on the Y axis
plt.tick_params(top='off', bottom='off', left='off', right='off', labelleft='off', labelbottom='on')
ax.tick_params()
offおよびの使用onは非推奨です。MatplotlibDeprecationWarning: Passing one of 'on', 'true', 'off', 'false' as a boolean is deprecated; use an actual boolean (True/False) instead.
すべての目盛りとラベルをオフにする短いコマンドを探している人は、
plt.tick_params(top=False, bottom=False, left=False, right=False, labelleft=False, labelbottom=False)
これはbool、バージョンmatplotlib> = 2.1.1以降の各パラメータのタイプを許可します
カスタムティック設定については、ドキュメントが役立ちます:
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.tick_params.html
ax.set_xticks([], [])そしてそれは解決されました...