I wrote a for-loop to generate a set of images:
for p in range(0,153):
im=plt.imshow(M[p,0:28,:].T,extent=[0,time.max(),depth.max(),0],aspect='auto')
plt.tight_layout()
cbar=plt.colorbar(im,orientation='vertical')
cbar.set_label('Vz[mm]')
plt.title('Rohdaten '+str(p)+'. Umlauf D874 Ch5')
plt.xlabel('Messzeit[s]')
plt.ylabel('Messtiefe[mm]')
savefig(os.path.join('/Users/gaoyingqiang/Desktop/1-153Umlauf',str(p)+'.png'))
But it turns the colorbar in the images was looping like:
I cannot understand why the colorbar was repeating itself.
If I interprete the incomplete code correctly, you want to save different figures, each with a colorbar.
plt.close("all")
.plt.clf()
, thereby operating on the same but emptied figure.Example:
for p in range(0,153):
im=plt.imshow(M[p,0:28,:].T,extent=[0,time.max(),depth.max(),0],aspect='auto')
plt.tight_layout()
cbar=plt.colorbar(im,orientation='vertical')
cbar.set_label('Vz[mm]')
plt.title('Rohdaten '+str(p)+'. Umlauf D874 Ch5')
plt.xlabel('Messzeit[s]')
plt.ylabel('Messtiefe[mm]')
savefig(os.path.join('/Users/gaoyingqiang/Desktop/1-153Umlauf',str(p)+'.png'))
plt.close("all")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With