Beispiel #1
0
        # ~  ax.set_xlabel('Time ($\mu$sec)')
        # ~  ax.set_ylabel('dI/dt $\\times 10^{-3}$(A)')
        # ~  ax.set_title('Input current di(z,t)')

        fig = plt.figure("Currents")
        ax1 = fig.add_subplot(2, 1, 1)
        ax1.plot(t_array_i * 1e6, i)
        ax1.set_ylabel("I (kA)")
        ax1.set_title("Original Input Current")
        ax2 = fig.add_subplot(2, 1, 2)
        ax2.plot((t_array - D / c) * 1e6, I_tl)
        ax2.set_xlabel("Time ($\mu$sec)")
        ax2.set_ylabel("$I_{TL}$ (kA)")
        ax2.set_title("Calculated RS Current")

        p5 = df.plotdf(fig, ax1)
        p6 = df.plotdf(fig, ax2)

        fig = plt.figure("Electric Fields")
        ax1 = fig.add_subplot(4, 1, 1)
        ax1.plot((t_array - D / c) * 1e6, E_es * 1e-3)
        s = "Electric fields ($kV/m$) at D = %0.3f km" % (D * 1.0e-3)
        ax1.set_title(s)
        ax1.set_ylabel("E_es ($kV/m$)")
        ax2 = fig.add_subplot(4, 1, 2)
        ax2.plot((t_array - D / c) * 1e6, E_ind * 1e-3)
        ax2.set_ylabel("E_ind ($kV/m$)")
        ax3 = fig.add_subplot(4, 1, 3)
        ax3.plot((t_array - D / c) * 1e6, E_rad * 1e-3)
        ax3.set_ylabel("E_rad ($kV/m$)")
        ax4 = fig.add_subplot(4, 1, 4)
Beispiel #2
0
    def __init__(self, data):
        Gtk.Window.__init__(self,title="Test plot window")
        self.set_default_size(800,600)
        
        self.connect("destroy", Gtk.main_quit)
        
        self.notebook = Gtk.Notebook()
        self.notebook.set_tab_pos(Gtk.PositionType.LEFT)
        
        self.numCols = 10
        labels = []
        models = []
        views = []
        scrolled_windows = []
        vboxes = []
        self.canvass = []
        
        for i in xrange(len(data)):
            label = Gtk.Label(data[i][2])
            labels.append(label)
            
        for d in data:
            models.append(self.create_model(d[1]))
            
        for model in models:
            views.append(self.create_view(model))
            
        for view in views:
            scw = Gtk.ScrolledWindow()
            scw.add(view)
            scrolled_windows.append(scw)
            
        for i in xrange(len(scrolled_windows)):
            box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
            
            try:
                x = data[i][0]
                y = data[i][1]
            
            except IndexError:
                raise
            
            fig = Figure(figsize=(6,4))
            self.canvass.append(FigureCanvas(fig))
            
            ax = fig.add_subplot(111)
            ax.plot(x, y)
            ax.set_title(data[i][2])

            p = df.plotdf(fig, ax)
            p.plot()
                        
            box.pack_start(scrolled_windows[i], True, True, 0)
            box.pack_start(self.canvass[i], True, True, 0)
            
            vboxes.append(box)
        #~ 
        #~ for i in xrange(len(figs)):
            #~ ps.append(df.plotdf(figs[i], axs[i]))
        
        for i in xrange(len(scrolled_windows)):
            
            self.notebook.append_page(vboxes[i], labels[i])
            
        self.add(self.notebook)
        
        #~ try:
            #~ self.x = data[0]
            #~ self.y = data[1]
        #~ 
        #~ except IndexError:
            #~ raise
        #~ 
        #~ self.fig = Figure(figsize=(6,4))
        #~ canvas = FigureCanvas(self.fig)
        #~ 
        #~ self.ax = self.fig.add_subplot(111)
        #~ self.ax.plot(self.x, self.y)
        #~ self.ax.set_title("Test")
        #~ 
        #~ self.p = df.plotdf(self.fig, self.ax)
        #~ self.p.plot()     
            #~ 
        #~ box = Gtk.Box()#orientation=Gtk.Orientation.VERTICAL)
        #~ 
        #~ box.pack_start(canvas, True, True, 0)
        #~ 
        #~ self.add(box)
        self.show_all()