예제 #1
0
    def graph(self):
        '''
        Graphs the current functions and plots the user has entered.
        '''
        #Get x range for y to be calculated off of
        x = Graph.get_x_range(Graph.xmin,Graph.xmax,Graph.x_increment)
        
        #Get all functions to plot
        functions_to_plot = Graph.get_on_functions()
        
        for fx in functions_to_plot:
            fx.update_function(x)

        #Now set up and plot the functions
        fig = self.graph_2d_plot_panel.get_figure()
        axes = fig.gca()
                
        # clear the axes and replot everything
        axes.cla()
        
        for fx in functions_to_plot:
            axes.plot(fx.x_values, fx.y_values,fx.get_color()+fx.get_line_style(), linewidth=1.0, label=fx.function_name)
        #Set the limits for the graph TODO get this working
        #axes.set_xlim((-100,100))
        axes.set_ylim(-1,1)