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
评论列表
文章目录