2017-11-23 12 views
0

。私は1つの図にいくつかのプロットをプロットしています。私はそれを付けました。あなたが見ることができるように、右側のプロットは乱雑で上書きされています。 誰かがこの問題や他の提案を避けるためにどのようにxユニットを増やすことができますか教えてください。pythonで、プロットの単位サイズを変更してください

これは右側のプロットのための私のコードです:

nx,ny= 9000, 16000 

xmin = -30.0e-6  # nm resolution 
xmax = 60.0e-6 

ymin = -80.0e-6  # nm resolution 
ymax = 80.0e-6 

X =np.linspace(xmin,xmax,nx) #Generate linearly spaced vector. The spacing between the points is (x2-x1)/(n-1). 
Y =np.linspace(ymin,ymax,ny) 

plt.subplot(333) 
fig1=plt.imshow(T_electron, extent=[X.min()*1e6, X.max()*1e6, Y.min()*1e6, Y.max()*1e6], vmin=0, vmax=T_ele_mean, cmap='brg', aspect='auto') 
plt.title('sdf '+ str(n)+ '; Time= ' +str(n*100)+ 'fs',color='Blue', fontsize=15) 
plt.xlabel('$') 
plt.ylabel('Tem_electron') 
plt.colorbar() 

plt.subplot(333) 
fig1=plt.imshow(T_proton, extent=[X.min()*1e6, X.max()*1e6, Y.min()*1e6, Y.max()*1e6], vmin=0, vmax=T_ele_mean, cmap='brg', aspect='auto') 
plt.title('sdf '+ str(n)+ '; Time= ' +str(n*100)+ 'fs',color='Blue', fontsize=15) 
plt.xlabel('$') 
plt.ylabel('Tem_proton') 
plt.colorbar() 

plt.subplot(333) 
fig1=plt.imshow(T_carbon, extent=[X.min()*1e6, X.max()*1e6, Y.min()*1e6, Y.max()*1e6], vmin=0, vmax=T_ele_mean, cmap='brg', aspect='auto') 
plt.title('sdf '+ str(n)+ '; Time= ' +str(n*100)+ 'fs',color='Blue', fontsize=15) 
plt.xlabel('$') 
plt.ylabel('Tem_carbon') 
plt.colorbar() 

enter image description here

答えて

1

使用set_xlim()と

+0

いいえ。私はX =( - 30、60)を維持したいが、10単位、すなわち-30,3 - 20、-10の代わりに30,0、30、60を持っていたい。だから私は単位距離を変更したい – masoud

1

通常、お好みの範囲を設定して、あなたは上のダニの数を制限することができますx軸またはy軸。あなたのケースのために、あなたは、xの軸は行うことができます:

plt.locator_params(axis='x', nticks=4) 

はもちろん、あなたが試行錯誤で便利な数になるようにnticksを変更することができます。

関連する問題