plt.errorbar问题:FutureWarning:元素比较失败;返回标量而不是

时间:2016-08-01 17:09:25

标签: python-3.x matplotlib graph warnings errorbar

当我使用plt.errorbar执行下面的代码时,我收到以下警告消息:

  

FutureWarning:元素比较失败;返回标量   相反,但在将来将执行元素比较if   self._edgecolors == str(' face'):

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1,2,3,4,5,6,7,8,9,10])
y = np.array([2,3,5,6,5,4,6,7,2,1])
yerreur = np.array([2,4,5,1,1,3,4,5,2,1])

plt.figure(1)

plt.errorbar(x,y,yerr = yerreur,fmt = 'None',ecolor = 'k')

plt.savefig('test.pdf')

plt.show()

如何解决此问题?它会以任何方式影响我的图表吗?

1 个答案:

答案 0 :(得分:1)

版本1.5.x中已解决此问题:

  

在合并之后它应该是1.5从master分支出来并且它在1.5.x分支上

Make sure _edgecolors is a string before comparison to string

尝试将matplotlib更新为最新版本。