title: convert datetime to number for matplotlib datetime xaxis
body: <p>How can I convert a datetime into a floating point representation that is used by matplotlib's x-axis? <code>matplotlib.dates.date2num</code> doesn't seem to work as per below...</p>
  <pre><code>import pandas as pd
  import matplotlib as mpl
  import datetime
  
  idx = pd.DatetimeIndex(
      [
          '2021-12-21 10:25:00+00:00', '2021-12-21 10:30:00+00:00',
          '2021-12-21 10:35:00+00:00', '2021-12-21 10:40:00+00:00',
          '2021-12-21 10:45:00+00:00', '2021-12-21 10:50:00+00:00',
          '2021-12-21 10:55:00+00:00', '2021-12-21 11:00:00+00:00',
          '2021-12-21 11:05:00+00:00', '2021-12-21 11:10:00+00:00'
      ],
      dtype='datetime64[ns, Europe/London]',
      name='time',
      freq=None
  )
  s = pd.Series(
      [0.6, 1.8, 2.7, 1.8, 1.5, 2.1, 0.9, 1.8, 3.2, 4.4],
      index=idx
  )
  
  fig, ax = plt.subplots()
  s.plot(ax=ax)
  
  target_x = datetime.datetime(2021, 12, 21, 18)
  target_y = 2
  
  ax.scatter(mpl.dates.date2num(target_x), target_y, marker='x')
  </code></pre>
  <p>The problem seems to be here:</p>
  <pre><code>&gt;&gt;&gt; ax.get_xlim()
  (27334705.0, 27334750.0)
  </code></pre>
  <p>whereas</p>
  <pre><code>&gt;&gt;&gt; mpl.dates.date2num(target_x)
  18982.75
  </code></pre>
  <h1>References</h1>
  <ul>
  <li><a href="https://stackoverflow.com/questions/13703720/converting-between-datetime-timestamp-and-datetime64">Converting between datetime, Timestamp and datetime64</a></li>
  <li><a href="https://stackoverflow.com/questions/34843513/python-matplotlib-dates-date2num-converting-numpy-array-to-matplotlib-datetimes">Python matplotlib.dates.date2num: converting numpy array to matplotlib datetimes</a></li>
  </ul>