import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.tick_params(axis="y",direction="in", pad=-22) ax.tick_params(axis="x",direction="in", pad=-15) plt.show()