set x axis range matplotlib code example
Example 1: set axis title matplotlib
fig.suptitle('test title', fontsize=20)
plt.xlabel('xlabel', fontsize=18)
plt.ylabel('ylabel', fontsize=16)
Example 2: set axis limits matplotlib
axes.set_xlim([xmin, xmax])
axes.set_ylim([ymin, ymax])
Example 3: how to set axis range matplotlib
fig, ax = plt.subplots(figsize=(12, 6))
ax.plot(y, label='y')
plt.xlim(lower, upper)
Example 4: pyplot set x range
fig, ax = plt.subplots(figsize=(12, 6))
x = np.arange(0, 10, 0.1)
y = np.sin(x)
z = np.cos(x)
ax.plot(y, color='blue', label='Sine wave')
ax.plot(z, color='black', label='Cosine wave')
plt.xlim([25, 50])
plt.show()