python - Why do I get an AttributeError when I use scatter() but not when I use plot() -
i wish plot using matplotlib/pylab , show date , time on x-axis. this, i'm using datetime module.
here working code required-
import datetime pylab import * figure() t2=[] t2.append(datetime.datetime(1970,1,1)) t2.append(datetime.datetime(2000,1,1)) xend= datetime.datetime.now() yy=['0', '1'] plot(t2, yy) print "lim is", xend xlim(datetime.datetime(1980,1,1), xend) however, when utilize scatter(t2,yy) command instead of plot (t2,yy), gives error:
attributeerror: 'numpy.string_' object has no attribute 'toordinal'
why happening , how can show scatter along plot?
a similar question has been asked before as- attributeerror: 'time.struct_time' object has no attribute 'toordinal' solutions don't help.
if utilize int or float type yy don't error scatter():
yy = [0, 1] python matplotlib python-datetime
No comments:
Post a Comment