I am using a numpy array with datetime values for my x-axis. Although the xData has gaps, matplot finds a way to fill them in the plot. I do not want that behavior. I want the x axis to plot the exact entries in the array "dates". Any suggestions?
import numpy as np
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
dates = np.array([datetime.datetime(2017, 3, 24, 14, 52),datetime.datetime(2017, 3, 24, 14, 56),datetime.datetime(2017, 3, 26, 16, 0),datetime.datetime(2017, 3, 26, 16, 4)])
yData = np.ones(len(dates))
fig = plt.figure(figsize=(6,6))
ax = plt.subplot(111)
li, = ax.plot(dates,yData)
plt.gcf().subplots_adjust(bottom=0.3)
ax.get_xaxis().tick_bottom()
xfmt = mdates.DateFormatter('%Y-%m-%d-%H:%M')
ax.xaxis.set_major_formatter(xfmt)
locs, labels = plt.xticks()
plt.setp(labels, rotation=90)
fig.canvas.draw()
plt.show()