Manipulate the major formatter to show the dates, and the minor formatter to show the time only
import numpy as np
import matplotlib.dates as dates
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(12, 4))
idx = pd.date_range('2018-01-07', '2018-01-09', freq='10min')
idx = np.arange('2018-01-07T00', '2018-01-09T02', 10, dtype='datetime64[m]')
y = np.sin(np.arange(idx.shape[0]) / 0.01)
plt.plot(idx, y)
ax.xaxis.set_minor_locator(dates.HourLocator(interval=4))
ax.xaxis.set_minor_formatter(dates.DateFormatter('%H:%M'))
ax.xaxis.set_major_locator(dates.DayLocator(interval=1))
ax.xaxis.set_major_formatter(dates.DateFormatter('\n%Y-%m-%d')) #the \n move major to the second line of label
plt.show()