I just want to show a matplotlib.image.AxesImage on a figure. But It can't
work properly. Can somebody help me? The code are following: when I run it
, It just show a white figure. But I Set it cm.Greens .It doesn't work .
Why?
# -*- coding:gb2312 -*-
import matplotlib
matplotlib.use("WXAgg")
matplotlib.interactive(True)
from matplotlib.backends.backend_wx import FigureCanvasWx
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from numpy import *
import wx
class ShowPlot():
def __init__(self,Frame):
delta = 0.025
x = arange(-2.0, 2.0, delta)
y = arange(-2.0, 2.0, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10.0 * (Z2 - Z1)
levels = arange(-1.2, 1.6, 0.2)
self.fig = Figure((6,6), 70)
self.canvas = FigureCanvasWx(Frame, -1, self.fig)
self.axe=self.fig.add_axes([0.1, 0.1, 0.8, 0.8])
i=matplotlib.image.AxesImage(self.axe,data=Z,interpolation='bilinear',
origin='lower',cmap=cm.Greens, extent=(-2,2,-2,2))
app = wx.PySimpleApp()
f=wx.Frame(None,size=(600,600))
f.Show(True)
ShowPlot(f)
app.MainLoop()
···
--
View this message in context: http://www.nabble.com/matplotlib.image.AxesImage-can't-work.-tf4897267.html#a14025951
Sent from the matplotlib - devel mailing list archive at Nabble.com.