Example #1
0
    def render(self, work, path ):
        
        self.startPlot()
        nplotted = 0

        xlabels, ylabels = [], []

        if len(work) < 2:
            raise ValueError( "requiring two coordinates, only got %s" % str(work.keys()))

        xlabel, ylabel = work.keys()[:2]
        xvals, yvals = Stats.filterNone( work.values()[:2])

        if len(xvals) == 0 or len(yvals) == 0:
            raise ValueError("no data" )

        # apply log transformation on data not on plot
        if self.logscale:
            if "x" in self.logscale:
                xvals = R.log10(xvals)
            if "y" in self.logscale:
                yvals = R.log10(yvals)
                
        R.smoothScatter( xvals, yvals, 
                         xlab=xlabel, ylab=ylabel,
                         nbin = self.nbins )

        return self.endPlot( work, path )
Example #2
0
    def render(self, dataframe, path ):
        
        if len(dataframe.columns) < 2:
            raise ValueError( "requiring two coordinates, only got %s" % str(dataframe.columns))

        plts, legend = [], []
        blocks = ResultBlocks()

        for xcolumn, ycolumn in itertools.combinations( dataframe.columns, 2 ):

            # remove missing data points
            xvalues, yvalues = Stats.filterMissing( (dataframe[xcolumn], dataframe[ycolumn]) )

            # remove columns with all NaN
            if len(xvalues) == 0 or len(yvalues) == 0:
                continue

            # apply log transformation on data not on plot
            if self.logscale:
                if "x" in self.logscale:
                    xvalues = R.log10(xvalues)
                if "y" in self.logscale:
                    yvalues = R.log10(yvalues)

            self.startPlot()
            # wrap, as pandas series can not
            # passed through rpy2.
            R.smoothScatter( numpy.array( xvalues, dtype=numpy.float), 
                             numpy.array( yvalues, dtype=numpy.float), 
                             xlab=xcolumn, 
                             ylab=ycolumn,
                             nbin = self.nbins )
            blocks.extend( self.endPlot( dataframe, path ) )

        return blocks
 def apply( self, xvals, yvals ):
     xx = numpy.array( [ x for x in xvals if x != None ] )
     yy = numpy.array( [ y for y in yvals if y != None ] )
     return Stats.doMannWhitneyUTest( xx, yy )
 def apply( self, xvals, yvals ):
     return Stats.doCorrelationTest( xvals, yvals, method = self.method )