Here is an extended example of how I will do this:
import datetime import matplotlib.pyplot as plt fig, ax = plt.subplots() t2=[ datetime.datetime(1970,1,1), datetime.datetime(2000,1,1) ] xend = datetime.datetime.now() yy= [0, 1] ax.plot(t2, yy, linestyle='none', marker='s', markerfacecolor='cornflowerblue', markeredgecolor='black', markersize=7, label='my scatter plot') print("lim is {0}".format(xend)) ax.set_xlim(left=datetime.datetime(1960,1,1), right=xend) ax.set_ylim(bottom=-1, top=2) ax.set_xlabel('Date') ax.set_ylabel('Value') ax.legend(loc='upper left')

source share