2016-04-04 41 views
0

我試圖使用標籤彩條錨widht

cbar.set_label('log10(Ha)', rotation=270) 

但是彩條號和傳說此圖像中重疊像我的彩條:

enter image description here

是否有人有這個問題可能的解決方案?

感謝您的幫助:)!

回答

0

我使用labelpad來調整顏色條和標籤之間的寬度。
這裏是一個例子,我從pylab_examples example code: contourf_demo.py剪輯的數據被省略以突出顯示條。

import numpy as np 
import matplotlib.pyplot as plt 
%matplotlib inline 

ax1 = plt.subplot(121) 
cbar1 = plt.colorbar(CS) 
cbar1.ax.set_ylabel('verbosity coefficient',labelpad = 15,fontsize = 15) 

ax2 = plt.subplot(122) 
cbar2 = plt.colorbar(CS) 
cbar2.ax.set_ylabel('verbosity coefficient',labelpad = 25,fontsize = 15) 

plt.tight_layout() 
plt.show() 

enter image description here

+0

太好了!它的工作,非常感謝:)! –

+0

不客氣。如果有幫助,你可以接受我的答案。 :) –