dfcb0f64f10b5161c6bc62136fd1245f37b6f8e4,scanpy/plotting/_stacked_violin.py,StackedViolin,_mainplot,#StackedViolin#Any#,297

Before Change


            _color_df = _color_df.T
        import matplotlib.colors

        norm = matplotlib.colors.Normalize(
            vmin=self.kwds.get("vmin"), vmax=self.kwds.get("vmax")
        )
        cmap = pl.get_cmap(self.kwds.get("cmap", self.cmap))
        if "cmap" in self.kwds:
            del self.kwds["cmap"]
        colormap_array = cmap(norm(_color_df.values))

After Change



        return self

    def _mainplot(self, ax):
        // to make the stacked violin plots, the
        // `ax` is subdivided horizontally and in each horizontal sub ax
        // a seaborn violin plot is added.

        // work on a copy of the dataframes. This is to avoid changes
        // on the original data frames after repetitive calls to the
        // StackedViolin object, for example once with swap_axes and other without
        _matrix = self.obs_tidy.copy()

        if self.var_names_idx_order is not None:
            _matrix = _matrix.iloc[:, self.var_names_idx_order]

        if self.categories_order is not None:
            _matrix.index = _matrix.index.reorder_categories(
                self.categories_order, ordered=True
            )

        // get mean values for color and transform to color values
        // using colormap
        _color_df = _matrix.groupby(level=0).median()
        if self.are_axes_swapped:
            _color_df = _color_df.T

        cmap = pl.get_cmap(self.kwds.get("cmap", self.cmap))
        if "cmap" in self.kwds:
            del self.kwds["cmap"]
        normalize = check_colornorm(
            self.vboundnorm.vmin,
            self.vboundnorm.vmax,
            self.vboundnorm.vcenter,
            self.vboundnorm.norm,
        )
        colormap_array = cmap(normalize(_color_df.values))
        x_spacer_size = self.plot_x_padding
        y_spacer_size = self.plot_y_padding
        self._make_rows_of_violinplots(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 17

Instances


Project Name: theislab/scanpy
Commit Name: dfcb0f64f10b5161c6bc62136fd1245f37b6f8e4
Time: 2021-03-14
Author: gokcen.eraslan@gmail.com
File Name: scanpy/plotting/_stacked_violin.py
Class Name: StackedViolin
Method Name: _mainplot


Project Name: theislab/scanpy
Commit Name: dfcb0f64f10b5161c6bc62136fd1245f37b6f8e4
Time: 2021-03-14
Author: gokcen.eraslan@gmail.com
File Name: scanpy/plotting/_baseplot_class.py
Class Name: BasePlot
Method Name: _mainplot


Project Name: theislab/scanpy
Commit Name: dfcb0f64f10b5161c6bc62136fd1245f37b6f8e4
Time: 2021-03-14
Author: gokcen.eraslan@gmail.com
File Name: scanpy/plotting/_stacked_violin.py
Class Name: StackedViolin
Method Name: _mainplot


Project Name: theislab/scanpy
Commit Name: dfcb0f64f10b5161c6bc62136fd1245f37b6f8e4
Time: 2021-03-14
Author: gokcen.eraslan@gmail.com
File Name: scanpy/plotting/_matrixplot.py
Class Name: MatrixPlot
Method Name: _mainplot