for i, size in enumerate(sizes):
    fig = plt.figure(figsize=size, dpi=80, facecolor='white', edgecolor=
        None, linewidth=0.0, frameon=True, subplotpars=None)
ax = fig.add_subplot(111)
ax.plot(x)
plt.ylabel('Some label')
plt.tight_layout()
make_invisible = True
if make_invisible:
    xticks = ax.xaxis.get_major_ticks()
xticks[0].label1.set_visible(False)
xticks[-1].label1.set_visible(False)
plt.show()
Matplotlib - hiding specific ticks on x-axis