2016-06-21 3 views
-1

plot of electric fieldplot of electron phase space distributionPythonの:私は、Pythonに新しいです

軸の長さを変え、私は付属のプロットを生成するには、このスクリプトを持って、

fig = plt.figure(figsize=(9,3.0)) 
ax = fig.add_subplot(111) 
mul = 1e-2 * m0 * c * wpe/q0 
im = ax.pcolormesh(X,Y,dat.Electric_Field_Ex.data[sx,sy]/mul) 
plt.yticks(np.arange(np.min(Y), np.max(Y)+1, 2.0)) 
plt.xlabel("X-Position") 
plt.ylabel("Y-Position") 

divider = make_axes_locatable(ax) 
cax = divider.append_axes("right", size="5%", pad=0.2) 
cbar = plt.colorbar(im, cax=cax) 
cbar.set_ticks(np.arange(-1, 4, 1)) 
ax.set_xlim([-x0,x0]) 
[enter image description here][1]plt.savefig('ex.png',dpi=300,bbox_inches='tight') 

私は長く、例えばx軸を作りたいです-5から5まで?これはどうすればいいですか?

任意の助けをいただければ幸いです...おかげ

答えて

2

は、単純にするXLIMを設定-5〜5:

ax.set_xlim([-5,5]) 
+0

感謝!私はそれを試してみます –

+0

それは感謝を働いた、私はそれを見ていたので、私はobvisousを見ることができませんでした!ありがとう –

+0

これはあなたのために働いた場合は、[解決を受け入れる](http://stackoverflow.com/help/accepted-answer)する必要があります。 – Scimonster

関連する問題