Seaborn countplot在Python中不接受x和y参数
我想用变量x来绘制变量y的频率,为此,我使用了seaborn.countplot()方法。但是,我收到一条错误消息 有关可复制的示例,请参见下文:Seaborn countplot在Python中不接受x和y参数,python,count,seaborn,Python,Count,Seaborn,我想用变量x来绘制变量y的频率,为此,我使用了seaborn.countplot()方法。但是,我收到一条错误消息 有关可复制的示例,请参见下文: surveys_species_by_plot_sample plot_id taxa 0 1 Bird 1 1 Rabbit 2 1 Rodent 3 2 Bird 4 2 Rabbit 5 2 Reptile 6 2 Rodent 7 3 Bird 8 3 Rabb
surveys_species_by_plot_sample
plot_id taxa
0 1 Bird
1 1 Rabbit
2 1 Rodent
3 2 Bird
4 2 Rabbit
5 2 Reptile
6 2 Rodent
7 3 Bird
8 3 Rabbit
9 3 Rodent
现在的目的是通过plot_id绘制分类群(鸟类、兔子等)的数量。我使用以下命令:
sn.countplot(x = "plot_id", y = "taxa", data = surveys_species_by_plot_sample,
palette = sn.color_palette(palette = ["SteelBlue" , "Salmon"], n_colors = 4))
我收到以下错误消息:
TypeError: Cannot pass values for both `x` and `y`
我不明白,因为文档说明x和y变量都可以传递给函数:
参数:x、y、色调:数据或矢量数据中变量的名称,
用于打印长格式数据的可选输入。有关详细信息,请参见示例
口译
数据:数据帧、数组或数组列表,用于
策划。如果x和y不存在,则被解释为宽形式。
否则,它将是长格式的
感谢您的建议。阅读中的示例,您只能通过x或y,不能同时通过。声明X或Y会更改图表的方向。您可能需要不同的图表类型