beeswarmplot.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:coquery 作者: gkunter 项目源码 文件源码
def plot_facet(self, data, color,
                   x=None, y=None, levels_x=None, levels_y=None,
                   palette=None, **kwargs):
        ax = kwargs.get("ax", plt.gca())
        corpus_id = "coquery_invisible_corpus_id"

        params = {"data": data, "palette": palette}
        self.horizontal = True
        if not x and not y:
            params.update({"x": corpus_id}),
            self._xlab = x
            self._ylab = ""
        elif x and not y:
            params.update({"x": x, "y": corpus_id, "order": levels_x})
            self.horizontal = False
            self._xlab = x
            self._ylab = "Corpus position"
        elif y and not x:
            params.update({"y": y, "x": corpus_id, "order": levels_y})
            self._xlab = "Corpus position"
            self._ylab = y
        elif x and y:
            params.update({"x": corpus_id, "y": y, "hue": x,
                           "order": levels_y, "hue_order": levels_x})
            self._xlab = "Corpus position"
            self._ylab = y

        sns.swarmplot(**params)
        return ax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号