set x label matplotlib code example
Example 1: add x axis label python
plt.xlabel("X axis label")
Example 2: change name of axis matplotlib
plt.xlabel('X axis')
plt.ylabel('Y axis')
Example 3: changing axis labels matplotlib
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
labels = [item.get_text() for item in ax.get_xticklabels()]
labels[1] = 'Testing'
ax.set_xticklabels(labels)
Example 4: label axis matplotlib
ax2.set_xlabel('time (s)')