Вот один дешевый хак. Я только показываю измененный код.
for hh in range(0, 58): # Increased the range
dates= dt.datetime.fromtimestamp(int(d+ (hh*1800)))
date1.append(dates)
closep1.append(randint(1,9))
# Plotting the complete range in white color to get the major ticks
a1.plot(date1, closep1, color='white')
a1.plot(date1[0:48], closep1[0:48]) # Plotting the wanted data only up to 48 in color
выход
