简体   繁体   中英

Plotting python matplotlib imshow from a Numpy array

I have the following data in excel sheet:

Time    Bin1    Bin2    Bin3    Bin4    Bin5
11:27:12    256.1   241.4   237.7   235.8   250.8
11:27:32    255.2   228.9   242.2   237.0   247.0
11:27:51    253.0   254.6   256.8   241.3   230.1
11:28:11    243.8   248.2   246.3   249.4   237.5
11:28:30    254.1   236.7   250.4   248.2   255.9
11:28:50    251.1   252.8   250.9   250.0   237.5
11:29:09    246.1   263.5   261.8   256.6   240.6
11:29:29    276.2   259.2   262.9   257.2   244.0
11:29:49    252.3   272.8   261.2   238.6   258.3
11:30:08    264.7   260.4   255.1   247.4   237.9

Using seaborn I get the following plot:

ax=sns.heatmap(xlsxsht1)
plt.show()

Works fine and displays Time on Y-axis correctly. But image is in square pixels. I need either interpolated or blurred image.

Using plt.imshow I can construct interpolated image, but only if I do not read in the Time column.

Have surfed on the internet, but could not find any example how correctly convert the time column from the file to the format, which is required and accepted by plt.imshow .

just convert the time to int in seconds like for example in How to convert an H:MM:SS time string to seconds in Python? and id say it must be on x axis

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM