Пример #1
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