I want my x axis has the label like this format
0 1 2 3 4 5 Xlabel
but I try code below it result me in 2 lines
self.axes.
Here is my variant of using @JoeKington method. I change last tick label to axis name. First I set last ticks to empty strings and then use annotate(). I've used annotate() because I need to control font size of axis label.
import numpy as np
import matplotlib.pyplot as plt
plt.xlim(50, 70)
plt.ylim(100, 250)
ax = plt.gca()
# clears last tick label
xticks = ax.get_xticks().tolist()
xticks[-1] = ''
ax.set_xticklabels(xticks)
yticks = ax.get_yticks().tolist()
yticks[-1] = ''
ax.set_yticklabels(yticks)
# sets axes labels on both ends
ax.annotate('$t$', xy=(0.98, 0), ha='left', va='top', xycoords='axes fraction', fontsize=20)
ax.annotate('$x$', xy=(0, 1), xytext=(-15,2), ha='left', va='top', xycoords='axes fraction', textcoords='offset points', fontsize=20)
plt.show(block=True)
Maybe someone knows more elegant way to do this, because it is ridiculously complex operation.