python多个箱线图_在同一图上的Python并排箱图

这篇博客介绍了如何在Python中使用Matplotlib和Seaborn库绘制箱线图,特别是针对Pandas数据框中的不同类别。作者展示了如何将类别1和2的数据分开,制作并排的箱线图,并提供了两种实现方式:一种使用多个子图,另一种利用Seaborn的boxplot函数和数据预处理技巧。示例代码详细展示了整个过程。
摘要由CSDN通过智能技术生成

1586010002-jmsa.png

I am trying to generate a box plot in Python 2.7 for each categorical value in column E from the Pandas dataframe below

A B C D E

0 0.647366 0.317832 0.875353 0.993592 1

1 0.504790 0.041806 0.113889 0.445370 2

2 0.769335 0.120647 0.749565 0.935732 3

3 0.215003 0.497402 0.795033 0.246890 1

4 0.841577 0.211128 0.248779 0.250432 1

5 0.045797 0.710889 0.257784 0.207661 4

6 0.229536 0.094308 0.464018 0.402725 3

7 0.067887 0.591637 0.949509 0.858394 2

8 0.827660 0.348025 0.507488 0.343006 3

9 0.559795 0.820231 0.461300 0.921024 1

I would be willing to do this with Matplotlib or any other plotting library. So far the above code can plot all the categories combined on one plot. Here is the code to generate the above data and produce the plot:

import numpy as np

impo

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值