2016-10-13 3 views
0

私のデータポイント間にこれらの線が表示されなくなりました。これは、エラーバーを追加しようとするたびに発生します。グラフを見ると、最初はエラーバーの行がなく、2番目のグラフはエラーバーの行です。これはPyplotエラーバーの通常の副作用ですか?それがなぜこれを行うのか、それをどうやって消すのか誰にも分かりますか?Pyplotのエラーバーはポイントをラインにつなぎ続けますか?

plt.figure() 
plt.scatter(x, y, label = 'blah') 
plt.errorbar(x, y, yerr = None, xerr = x_err) 
plt.plot(x, f) #this is a line of best fit 

enter image description here enter image description here

答えて

4

あなたはnoneにラインスタイル(ls)を設定することができます

import numpy as np 
import matplotlib.pylab as plt 

x = np.arange(10) 
y = np.arange(10) 
yerr = np.random.random(10) 
xerr = np.random.random(10) 

plt.figure() 
plt.subplot(121) 
plt.scatter(x, y, label = 'blah') 
plt.errorbar(x, y, yerr = None, xerr = xerr) 

plt.subplot(122) 
plt.scatter(x, y, label = 'blah') 
plt.errorbar(x, y, yerr = None, xerr = xerr, ls='none') 

enter image description here

+0

それを行っています。つまり、本当にありがとうございました! –

関連する問題