mardi 31 mars 2015

How to use AnnotationBbox with timestamps

I have produced a plot with timestamps. Now I want to upload an image to that graph by using following code.



fn = get_sample_data("path of image", asfileobj=False)
arr_lena = read_png(fn)
imagebox = OffsetImage(arr_lena, zoom=0.5)
ab = AnnotationBbox(imagebox,xy=(0,0),xybox=None,xycoords='data',boxcoords=None, box_alignment=(0,0))
ax.add_artist(ab)
plt.draw()
plt.show()


Now it is stating an error as dt = datetime.datetime.fromordinal(ix) ValueError: ordinal must be >= 1


I think this is because my x-axis ticks are dates. How to deal with this problem.


Aucun commentaire:

Enregistrer un commentaire