Why is set_xlim() not setting the x-limits in my figure?

Out of curiosity, what about switching in the old xmin and xmax?

fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(x_data,y_data)
ax.set_xlim(xmin=0.0, xmax=1000)
plt.savefig(filename)

The text of this answer was taken from an answer that was deleted almost immediately after it was posted.

set_xlim() limits the data that is displayed on the plot.

In order to change the bounds of the axis, use set_xbound().

fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(x_data,y_data)
ax.set_xbound(lower=0.0, upper=1000)
plt.savefig(filename)