I have data stored in a 1000x1000 matrix that I plot using plt.imshow(), resulting in the following image:
However, the y-axis are supposed to range from 0 to 300 and the x-axis from 0 to 1. I've tried using 'extent=[0,1,0,300]', but this results in the following:
I am wondering how I can adjust the values on the axes while retaining the 1:1 aspect-ratio (this is to create a Hovmöller plot, so the y-axis is unrelated to space).
plt.figure(1)
plt.imshow(phi.T, extent=[0,1,0,300], origin='lower')
cbar = plt.colorbar()
plt.show()
plt.imshow(phi.T, extent=[0,1,0,300], aspect=1/300)
应该做到这一点
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.