Sublots in several figures

Hi!

I have 3 line charts which I would like to add one by one in a Figure() (back-to-back) to a wxPython Scrollpanel . I tried this code but all 3 charts are allways put together in each figure. How can I add them seperate in one figure?

Thanks in advance! The data files are attached.

Stefanie

-- coding: latin1 --

import sys

import wx
import wx.lib.scrolledpanel as SP

from matplotlib.backends.backend_wx import FigureCanvasWx
from matplotlib.figure import Figure
import matplotlib.numerix as numpy
from pylab import array, arange, sin, cos, exp, pi, randn, normpdf, meshgrid,
convolve

class MyFrame(wx.Frame):

def __init__(self):
    wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
    self.panel = SP.ScrolledPanel(self, -1)
    self.panel.SetBackgroundColour('WHITE')
  
    vbox = wx.BoxSizer(wx.VERTICAL)
    sizer = wx.GridBagSizer(hgap=10, vgap=5)
   
    f_a = open('all_name_list.txt', 'r')
    #f_e = open('eff_name_list.txt', 'r')

    all = f_a.readlines()
    #eff = f_e.readlines()
    n = 1
    for i in all:
        self.fig = Figure()
        self.canvas = FigureCanvasWx(self.panel, -1, self.fig)
        sizer.Add(self.canvas, pos=(n, 1), flag=wx.EXPAND|wx.GROW|wx.ALIGN_CENTER)
        n = n + 1
        self.plot_data(self.fig)
   
    vbox.Add(sizer, 0, wx.ALL|wx.ALIGN_CENTER, 10)

    self.panel.SetSizer(vbox)
    self.panel.SetAutoLayout(1)
    self.panel.SetupScrolling()
  
    self.ShowFullScreen(True, style = wx.FULLSCREEN_NOMENUBAR)

def plot_data(self, figure):
    f_a = open('all_name_list.txt', 'r')
    #f_e = open('eff_name_list.txt', 'r')

    all = f_a.readlines()
    #eff = f_e.readlines()
   
    for a in all:
        a = a.replace('\n', '')
        f = open(a + '_eff_counts.txt', 'r')
        data = f.readlines()
       
        listex = []
        listey = []
        for line in data:
            line = line.strip()
            x = line.split(" ")
            listex.append(int(x[0]))
            listey.append(int(x[1]))
       
        b = figure.add_subplot(111)
        b.plot(listex,listey)
        #b = figure.add_subplot(111)
    #b.plot([0,2,4,122], [4, 8, 10, 140])
        b.set_xbound(0, 2100)
        b.set_ybound(-5, 50)
        b.set_title(a)

if name == ‘main’:
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show(True)
app.MainLoop()

Contig5535_all_counts.txt (13.2 KB)

62834610.r_h05_2_all_counts.txt (13.3 KB)

all_name_list.txt (39 Bytes)

Contig5534_all_counts.txt (14.6 KB)