如何在使用matplotlib时修复“MaskedArrayFutureWarning”?

时间:2017-07-30 03:01:19

标签: python python-3.x

当我使用matplotlib时出现以下错误。我想知道修复此警告消息。我试图在axis = 0中传递plt.contourf(),但这没有帮助。

警告:

C:\Users\user\Anaconda3\lib\site-packages\numpy\ma\core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)

代码:

figT = plt.figure(figsize=(20,15)) # (width, height)
for i in range(n_cases):
    ax = plt.subplot(3, 3, i+1)
    plt.contourf(x, y, sess.run(T[:,:,i]), colorInterpolation, cmap=colorMap)
    plt.colorbar().ax.set_ylabel('Temperature ($^\circ$C)', fontsize = set_fontSize)
    plt.xlabel('X Position', fontsize = set_fontSize)
    plt.ylabel('Y Position', fontsize = set_fontSize)
    plt.title("Case %d" % (i+1), fontsize = set_fontSize)
figT.savefig(dirFig+'T_results.png', format='png', dpi=set_dpi, bbox_inches='tight')

1 个答案:

答案 0 :(得分:2)

使用matplotlib 1.5.3时出现此错误。我发出以下命令后:

conda update matplotlib

Matplotlib已更新至2.0.2并且警告已消失。