python图形绘制 绘图窗体怎么没有_绘图窗口未显示在matplotlib中

我尝试使用matplot lib绘制图形,但没有显示窗口:

我从一个使用matplotlib的等高线演示程序中得到了这段代码。在import matplotlib

import numpy as np

import matplotlib.mlab as mlab

import matplotlib.pyplot as plt

matplotlib.rcParams['xtick.direction'] = 'out'

matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.025

x = np.arange(-3.0, 3.0, delta)

y = np.arange(-2.0, 2.0, delta)

X, Y = np.meshgrid(x, y)

Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)

Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)

# difference of Gaussians

Z = 10.0 * (Z2 - Z1)

# Create a simple contour plot with labels using default colors. The

# inline argument to clabel will control whether the labels are draw

# over the line segments of the contour, removing the lines beneath

# the label

plt.figure()

CS = plt.contour(X, Y, Z)

plt.clabel(CS, inline=1, fontsize=10)

plt.title('Simplest default with labels')

plt.show()

现在我想表演()显示一个图,但是当我运行程序时,我没有看到一个图,而是得到一个错误消息,说:

^{pr2}$

有什么办法解决这个问题吗?在

谢谢你抽出时间。在


版权声明:本文为weixin_35110330原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。