예제 #1
0
    def plot(self, experiment, **kwargs):
        """Plot a faceted histogram view of a channel"""
        
        kwargs.setdefault('histtype', 'stepfilled')
        kwargs.setdefault('alpha', 0.5)
        kwargs.setdefault('antialiased', True)

        if not self.subset:
            x = experiment.data
        else:
            x = experiment.query(self.subset)
            
        num_bins = num_hist_bins(x[self.channel])
        xmin = np.amin(x[self.channel])
        xmax = np.amax(x[self.channel])
        bin_width = (xmax - xmin) / num_bins
        bins = np.arange(xmin, xmax, bin_width)
        kwargs.setdefault('bins', bins) 

        g = sns.FacetGrid(x, 
                          col = (self.xfacet if self.xfacet else None),
                          row = (self.yfacet if self.yfacet else None),
                          hue = (self.huefacet if self.huefacet else None),
                          legend_out = False)
        
        g.map(plt.hist, self.channel, **kwargs)
        g.add_legend()
예제 #2
0
    def plot(self, experiment, **kwargs):
        """Plot a faceted histogram view of a channel"""
        
        #kwargs.setdefault('histtype', 'stepfilled')
        #kwargs.setdefault('alpha', 0.5)
        kwargs.setdefault('edgecolor', 'none')
        #kwargs.setdefault('mincnt', 1)
        #kwargs.setdefault('bins', 'log')
        kwargs.setdefault('antialiased', True)
        
        if not self.subset:
            x = experiment.data
        else:
            x = experiment.query(self.subset)
            
        xmin, xmax = (np.amin(x[self.xchannel]), np.amax(x[self.xchannel]))
        ymin, ymax = (np.amin(x[self.ychannel]), np.amax(x[self.ychannel]))
        # to avoid issues with singular data, expand the min/max pairs
        xmin, xmax = mtrans.nonsingular(xmin, xmax, expander=0.1)
        ymin, ymax = mtrans.nonsingular(ymin, ymax, expander=0.1)
        
        extent = (xmin, xmax, ymin, ymax)
        kwargs.setdefault('extent', extent)
        
        xbins = num_hist_bins(experiment[self.xchannel])
        ybins = num_hist_bins(experiment[self.ychannel])
        bins = np.mean([xbins, ybins])
        
        kwargs.setdefault('bins', bins) # Do not move above.  don't ask.

        g = sns.FacetGrid(x, 
                          col = (self.xfacet if self.xfacet else None),
                          row = (self.yfacet if self.yfacet else None),
                          hue = (self.huefacet if self.huefacet else None))
        
        g.map(plt.hexbin, self.xchannel, self.ychannel, **kwargs)