与 Seaborn 并排的猫图 [英] Catplot with Seaborn, side by side

查看:54
本文介绍了与 Seaborn 并排的猫图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的这段代码来绘制与Seaborn的关系图.可以.

I'm using this code below to plot a catplot with Seaborn. Its working ok.

sns.catplot(data=df_gol,
            x='MODALIDADE_DO_VOO',
            y='VALOR',row='DESTINO',
            kind='box',height=3, aspect=1,
            color='red')

但是我要把每个箱形图堆积起来.

But I am getting each box-plot stacked.

我想并排绘制它.我该怎么做?

I'd like to plot it side by side. How can I do that?

我的 DF (df_gol) 具有以下值:

My DF (df_gol) has these values:

Column DESTINO - ['JPA', 'FOR', 'SSA', 'AJU']
Column MODALIDADE_DO_VOO - ['Direto', '1 parada']
Columns VALOR is float type

我一直在寻找一些例子,但我不明白如何去做.

I've been looking for some examples but I didn't understand how to do it.

谢谢.

推荐答案

使用

use the col= keyword instead of the row= to organize your subplots in columns. You can adjust the number of plots per row by using the col_wrap= argument.

sns.catplot(data=df_gol,
            x='MODALIDADE_DO_VOO',
            y='VALOR',col='DESTINO',       # <--- replaced row= by col=
            kind='box',height=3, aspect=1,
            color='red')

这篇关于与 Seaborn 并排的猫图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆