7
とバー...matplotlibのIは、非対称エラーバーとバーグラフをプロットする必要が非対称のエラーバー
matplotlib.pyplot.bar機能のドキュメントは言う:
Detail: xerr and yerr are passed directly to errorbar(), so they can also have shape 2xN for independent specification of lower and upper errors.
しかし、私ができます... yerrに
import numpy as np
import matplotlib.pyplot as plt
plt.bar(xrange(5), [2,5,3,4,7], yerr=[[1,4,2,3,6],[4,10,6,8,14]]) #DO NOT work!
を2xNのアレーを与え、私に次のエラーが表示されない:
Traceback (most recent call last):
File "bar_stacked.py", line 9, in <module>
plt.bar(xrange(5), [2,5,3,4,7], yerr=[[1,4,2,3,6],[4,10,6,8,14]])
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 1742, in bar
ret = ax.bar(left, height, width, bottom, color, edgecolor, linewidth, yerr, xerr, ecolor, capsize, align, orientation, log, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 4253, in bar
"incompatible sizes: bar() argument 'yerr' must be len(%s) or scalar" % nbars)
ValueError: incompatible sizes: bar() argument 'yerr' must be len(5) or scalar
しかし、代わりにこの機能:
import numpy as np
import matplotlib.pyplot as plt
plt.errorbar(xrange(5), [2,5,3,4,7], yerr=[[1,4,2,3,6],[4,10,6,8,14]])
作品罰金。
matplotlib.pyplot.barはyerrの2xN配列をサポートしていませんか? 答えが肯定の場合...非対称のエラーバーで棒グラフをプロットするにはどうすればよいですか?
ありがとうございました!
私は0.99.3バージョンを持っています...私は1.1.1をコンパイルしています、ありがとう! – Geparada
解決済み!ありがとうございます。 – Geparada