In matplotlib
, one of the axes may be of datetime values. The following example, for instance, works well:
import datetime as dt
import matplotlib.patches as patches
circle = patches.Circle(xy=(dt.datetime.now(), 1), radius=5)
But this fails:
cp = patches.CirclePolygon(xy=(dt.datetime.now(), 1), radius=5, resolution=10)
with this error:
Traceback (most recent call last):
File "testcpol.py", line 14, in <module>
p = patches.CirclePolygon(xy=(x, y), radius=5, resolution=10)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/patches.py", line 1349, in __init__
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/patches.py", line 797, in __init__
self._update_transform()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/patches.py", line 805, in _update_transform
.translate(*self.xy)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/transforms.py", line 1945, in translate
np.float_)
TypeError: float() argument must be a string or a number
Seems like CirclePolygon
tries to convert the datetime into a float for some reason. Any idea why, or how to bypass it?