Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
The following example
In [1]:x=np.array(range(100),dtype='M8[D]')In [2]:ax=plt.subplot(1,1,1)In [3]:y=np.random.random(100)In [4]:ax.bar(x,y)Out[4]:<BarContainerobjectof100artists>
works fine, but if I set width to be the diff of thedatetime64
array, which gives atimedelta64
array, things break:
In [7]:ax.bar(x[:-1],y[:-1],width=np.diff(x))---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)<ipython-input-7-f05692d600cb>in<module>()---->1ax.bar(x[:-1],y[:-1],width=np.diff(x))~/miniconda3/envs/dev/lib/python3.6/site-packages/matplotlib/__init__.pyininner(ax,*args,**kwargs)1853"the Matplotlib list!)"% (label_namer,func.__name__),1854RuntimeWarning,stacklevel=2)->1855returnfunc(ax,*args,**kwargs)18561857inner.__doc__=_add_data_doc(inner.__doc__,~/miniconda3/envs/dev/lib/python3.6/site-packages/matplotlib/axes/_axes.pyinbar(self,*args,**kwargs)2257ifalign=='center':2258iforientation=='vertical':->2259left=x-width/22260bottom=y2261eliforientation=='horizontal':TypeError:ufuncsubtractcannotuseoperandswithtypesdtype('float64')anddtype('<m8[D]')
This should however be unambiguous, so it would be nice if it worked.