Issue 1:
Bug report

Bug summary

A call to axhline followed by plotting with dates yields an exception.

This arises when trying to reproduce #7742.

Code for reproduction

import matplotlib.pyplot as plt
from datetime import datetime

fig, ax = plt.subplots()

ax.axhline(1.5)
ax.plot([datetime(2016, 1, 1, 0, 0, 0), datetime(2016, 1, 2, 0, 0, 0)], [1, 2])

Actual outcome

TypeError Traceback (most recent call last)
<ipython-input-5-02e4fc5c74c6> in <module>
5
6 ax.axhline(1.5)
----> 7 ax.plot([datetime(2016, 1, 1, 0, 0, 0), datetime(2016, 1, 2, 0, 0, 0)], [1, 2])

~/work/programs/py/mpl/matplotlib/lib/matplotlib/axes/_axes.py in plot(self, scalex, scaley, data, *args, **kwargs)
1743 lines = [*self._get_lines(*args, data=data, **kwargs)]
1744 for line in lines:
-> 1745 self.add_line(line)
1746 self._request_autoscale_view(scalex=scalex, scaley=scaley)
1747 return lines

~/work/programs/py/mpl/matplotlib/lib/matplotlib/axes/_base.py in add_line(self, line)
1975 line.set_clip_path(self.patch)
1976
-> 1977 self._update_line_limits(line)
1978 if not line.get_label():
1979 line.set_label('_line%d' % len(self.lines))

~/work/programs/py/mpl/matplotlib/lib/matplotlib/axes/_base.py in _update_line_limits(self, line)
1997 Figures out the data limit of the given line, updating self.dataLim.
1998 """
-> 1999 path = line.get_path()
2000 if path.vertices.size == 0:
2001 return

~/work/programs/py/mpl/matplotlib/lib/matplotlib/lines.py in get_path(self)
1009 """
1010 if self._invalidy or self._invalidx:
-> 1011 self.recache()
1012 return self._path
1013

~/work/programs/py/mpl/matplotlib/lib/matplotlib/lines.py in recache(self, always)
651 if always or self._invalidx:
652 xconv = self.convert_xunits(self._xorig)
--> 653 x = _to_unmasked_float_array(xconv).ravel()
654 else:
655 x = self._x

~/work/programs/py/mpl/matplotlib/lib/matplotlib/cbook/__init__.py in _to_unmasked_float_array(x)
1296 return np.ma.asarray(x, float).filled(np.nan)
1297 else:
-> 1298 return np.asarray(x, float)
1299
1300
~/miniconda3/envs/mpl1/lib/python3.7/site-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87

TypeError: float() argument must be a string or a number, not 'datetime.datetime'

Expected outcome

A plot, with or without the bug from #7742.

Matplotlib version

Matplotlib version: 3.3.0rc1.post273+gb803891a4b

Issue 2:
Bug report

On master branch, plotting datetimes appears to be broken. This error bisects to a793bde in #17022

Code for reproduction

import matplotlib.pyplot as plt
from datetime import datetime

fig, ax = plt.subplots()
ax.plot(datetime.now(), 1)
plt.show()

Actual outcome

File "test.py", line 5, in <module>
ax.plot(datetime.now(), 1)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_axes.py", line 1745, in plot
self.add_line(line)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_base.py", line 1977, in add_line
self._update_line_limits(line)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/axes/_base.py", line 1999, in _update_line_limits
path = line.get_path()
File "/Users/dstansby/github/matplotlib/lib/matplotlib/lines.py", line 1011, in get_path
self.recache()
File "/Users/dstansby/github/matplotlib/lib/matplotlib/lines.py", line 653, in recache
x = _to_unmasked_float_array(xconv).ravel()
File "/Users/dstansby/github/matplotlib/lib/matplotlib/cbook/__init__.py", line 1298, in _to_unmasked_float_array
return np.asarray(x, float)
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.8/site-packages/numpy/core/_asarray.py", line 83, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: float() argument must be a string or a number, not 'datetime.datetime'

Expected outcome

Matplotlib version

Operating system:

Matplotlib version:

Matplotlib backend (print(matplotlib.get_backend())):

Python version:

Jupyter version (if applicable):

Other libraries: