Пример #1
0
    def plot_density(x, y, peak, valley, th, file):
        """Plot kernel density function.

        Parameters
        ----------
        x, y : np.array
            data points of density function
        peak, valley : float
            x-coordinate of first peak or valley
        th : float
            x-coordinate of threshold
        file : str
            filename to save plot

        Notes
        -----
        1. Generate a density plot, with 1st peak and 1st valley circled, and
           threshold indicated by a vertical dashed line.
        2. Export density plot to image file `file`.
        """
        fig = plt.figure(figsize=(5, 5))
        plt.plot(x, y)
        plt.plot([peak], [y[np.where(x == peak)]], marker='o')
        plt.plot([valley], [y[np.where(x == valley)]], marker='o')
        plt.axvline(th, color='grey', linestyle='--')
        plt.xlabel('Score')
        plt.ylabel('Frequency')
        save_figure(fig, file)
        plt.close()
Пример #2
0
 def plot_hgts(self):
     """Plot HGT prediction results.
     """
     fig = plt.figure(figsize=(5, 5))
     plt.scatter('close', 'distal', c='hgt', data=self.df)
     plt.xlabel('Close')
     plt.ylabel('Distal')
     save_figure(fig, join(self.output, 'scatter.png'))
Пример #3
0
    def plot_hgts(self):
        """Plot HGT prediction results.

        Notes
        -----
        1. Generate a scatter plot with putative HGTs colored.
        2. Export scatter plot to image file `scatter.png`.
        """
        fig = plt.figure(figsize=(5, 5))
        plt.scatter('close', 'distal', c='hgt', data=self.df)
        plt.xlabel('Close')
        plt.ylabel('Distal')
        save_figure(fig, join(self.output, 'scatter.png'))
        plt.close()
Пример #4
0
    def plot_hist(data, file):
        """Plot histogram.

        Parameters
        ----------
        data : iterable of float
            data to plot histogram
        file : str
            filename to save plot
        """
        fig = plt.figure(figsize=(5, 5))
        plt.hist(data)
        plt.xlabel('Score')
        plt.ylabel('Frequency')
        save_figure(fig, file)
Пример #5
0
    def plot_density(x, y, peak, valley, th, file):
        """Plot kernel density function.

        Parameters
        ----------
        x, y : np.array
            data points of density function
        peak, valley : float
            x-coordinate of first peak or valley
        th : float
            x-coordinate of threshold
        file : str
            filename to save plot
        """
        fig = plt.figure(figsize=(5, 5))
        plt.plot(x, y)
        plt.plot([peak], [y[np.where(x == peak)]], marker='o')
        plt.plot([valley], [y[np.where(x == valley)]], marker='o')
        plt.axvline(th, color='grey', linestyle='--')
        plt.xlabel('Score')
        plt.ylabel('Frequency')
        save_figure(fig, file)