From: <phi...@ho...> - 2005-10-26 09:58:19
|
Hi John and list, Sorry to take your time. from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar when i do: |fig = Figure(figsize=(5,4), dpi=100)||| |ax = fig.add_subplot(111) # 1| |t = arange(0.0,3.0,0.01)| |s = sin(2*pi*t)| |ax.plot(t,s)||||| |canvas = FigureCanvas(fig)| |vbox.pack_start(canvas)| |toolbar = NavigationToolbar(canvas, win)| |vbox.pack_start(toolbar, False, False) | |I can zoom on the figure and it is redrawn. |My problem is i need to create a subplot instance myself: |fig = Figure(figsize=(5,4), dpi=100) ax = Subplot(fig,111) || # 1|| t = arange(0.0,3.0,0.01) s = sin(2*pi*t) ax.plot(t,s) fig.add_subplot(ax) ||# 2 -> To display the hand subplot in the figure.| |canvas = FigureCanvas(fig) vbox.pack_start(canvas) toolbar = NavigationToolbar(canvas, win) vbox.pack_start(toolbar, False, False)| The application is crashing. GTK seems to fail displaying the canvas. Is it a bug or am i doing something wrong? Thanks a lot for the answer, Regards, Philippe Collet |