예제 #1
0
    def show_from_function(self,
                           function,
                           xmin,
                           xmax,
                           discr,
                           xlabel="",
                           ylabel=""):
        """ Plot mathematic function

        Parameters
        ----------
        function : str
            the mathematic function
        xmin :  int
            the x min
        xmax : int
            the x max
        discr : int
            the discretization of the interval between xmin and xmax
        xlabel :  str
            the name of the x label
        ylabel : str
            the name of the y label
        """
        logger.log(logging.INFO, "[CliHandler] Plot function " + function)
        fig, ax = plt.subplots()
        graph_clear(ax)
        graph_from_function(ax, function, xmin, xmax, discr, xlabel, ylabel)
        plt.show()
예제 #2
0
    def show_diff_from_fieldnames(self,
                                  x_fieldname,
                                  y_fieldnames,
                                  values=False):
        """ Plot difference between two graph from fieldnames in a plt matplotlib object

        Parameters
        ----------
        x_fieldname : str
            the fieldname of the x-axis variable to plot
        y_fieldnames : list(str)
            the list of fieldname of the y-axis variable for the two plot to compare
        values : boolean
            display the diff values on the graph
        """
        if self.__data_manager is not None:
            logger.log(
                logging.INFO, "[CliHandler] Show from field names " +
                x_fieldname + " " + str(y_fieldnames))
            fig, ax = plt.subplots()
            graph_clear(ax)
            graph_compare_plot_from_fieldnames(ax, self.__data_manager,
                                               x_fieldname, y_fieldnames)
            if values:
                graph_compare_plot_values_from_fieldnames(
                    ax, self.__data_manager, x_fieldname, y_fieldnames, 0.1,
                    True)
            plt.show()
        else:
            logger.log(logging.INFO, "[CliHandler] No data to show")
예제 #3
0
    def on_list_select(self, evt=None):
        """ Display plots when plots are selected in the list (triggered by event on the list) """
        graph_clear(self.__graph)
        plot_ids = []
        for idx in self.__plot_list.curselection():
            plot_ids.append(self.__plot_list.get(idx))

        if len(self.__plot_list.curselection()) == 2:
            self.__compare_button['state'] = 'normal'
        else:
            self.__compare_button['state'] = 'disabled'

        if len(plot_ids) > 0:
            graph_from_plot_ids(self.__graph, plot_ids,
                                self.__marker_combo.get(),
                                self.__line_combo.get(),
                                float(self.__entry_line_width.get()))
            self.__canvas.draw()
        else:
            self.clear_all_plots()
예제 #4
0
    def display(self):
        """ Display in the graph frame """
        graph_clear(self.__graph)

        if self.__chkbx_g.get():
            graph_compare_plot(self.__graph, self.__plots[0], self.__plots[1],
                               self.__marker, self.__linestyle,
                               self.__linewidth)

        if self.__chkbx_d.get():
            graph_compare_plot_diff(self.__graph, self.__plots[0],
                                    self.__plots[1], self.__marker,
                                    self.__linestyle, self.__linewidth)

        if self.__chkbx_v.get():
            graph_compare_plot_values(self.__graph, self.__plots[0],
                                      self.__plots[1],
                                      float(self.__entry_threshold.get()),
                                      bool(self.__chkbx_d.get()),
                                      int(self.__entry_round.get()))
        self.__canvas.draw()
예제 #5
0
    def show_from_fieldnames(self, x_fieldname, y_fieldnames):
        """ Plot multiple data from fieldnames in a plt matplotlib object

        Parameters
        ----------
        x_fieldname : str
            the fieldname of the x-axis variable to plot
        y_fieldnames : list(str)
            the list of fieldname of the y-axis variable to plot
        """
        if self.__data_manager is not None:
            logger.log(
                logging.INFO, "[CliHandler] Show from field names " +
                x_fieldname + " " + str(y_fieldnames))
            fig, ax = plt.subplots()
            graph_clear(ax)
            graph_from_fieldnames(ax, self.__data_manager, x_fieldname,
                                  y_fieldnames)
            plt.show()
        else:
            logger.log(logging.INFO, "[CliHandler] No data to show")
예제 #6
0
 def clear(self):
     """ Clear the graph frame """
     graph_clear(self.__graph)
     self.__canvas.draw()
예제 #7
0
 def clear_all_plots(self):
     """ Clear/reset the plot frame """
     logger.log(logging.INFO, "[PlotFrame] Clear all plots")
     graph_clear(self.__graph)
     self.__plot_list.selection_clear(0, tkinter.END)
     self.__canvas.draw()