首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用contourf时Python Matpolotlib错误

使用contourf时Python Matpolotlib错误
EN

Stack Overflow用户
提问于 2017-04-28 03:39:46
回答 1查看 159关注 0票数 0

我正在尝试执行以下程序,并在结果结束时收到警告。请教我这个错误。

"/usr/lib/pymodules/python2.7/matplotlib/collections.py:548: FutureWarning:元素比较失败;相反,返回标量,但如果self._edgecolors == 'face':“,将来将执行元素比较。”

代码语言:javascript
复制
        import numpy as np
        import matplotlib.pyplot as plt

        colorinterpolation = 50
        colourMap = plt.cm.jet

        x =  input('Number of nodes in the vertical axis: ')
        y =  input('Number of nodes in the horizontal axis: ')
        TI = input('Initial tempertature: ')
        TN = input('Northern boundary temperature: ')
        TS = input('Southern boundary temperature: ')
        TE = input('Eastern boundary temperature: ')
        TW = input('Western boundary temperature: ')
        t  = input('Number of time steps needed: ')
        C1 = input('Courant number in x direction: ')
        C2 = input('Courant number in y direction: ')
        C3 = 1 - (2*C1) - (2*C2)

        T = np.zeros((x, y))
        T.fill(TI)
        print 'Time step 0'
        print T
        for timestep in range(1, t+1):
            T[:1, :] = TN
            T[x-1:, :] = TS
            T[:, :1] = TW
            T[:, y-1:] = TE 
            print 'Time step', timestep 
            for j in range(1, y-1, 1):
                for i in range(1, x-1, 1):
                    T[i, j] = T[i, j]*C3 + C1*(T[i+1,j] + T[i-1, j]) + C2*(T[i, j+1] + T[i, j-1])
            print T

       plt.contourf(np.flipud(T), colorinterpolation, cmap=colourMap)
       plt.title('2-D transient heat conduction')
       plt.colorbar()
       plt.show()
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-28 17:10:45

请记住,这实际上不是一个错误,只是一个警告。所以你可以忽略它,如果不是这样的话,所有的事情都像预期的那样工作。它可能是由版本之间的某些不匹配引起的,参见这里

如果您真的想消除这个警告,可以考虑更新numpy和matplotlib。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43671582

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档