熊猫盒图错误绘制

时间:2019-10-23 01:49:19

标签: python-3.x pandas matplotlib

我正在尝试为数据框中的所有列创建框线图,但是第一列(第8号外显子)的结果框线图具有不在数据框中的点。它显示了一个不应该存在的异常值,以及其上方的第二个箱线图。 Resulting image can be found here

print(ugh) 

              Exon 8      Exon 7      Exon 6   Exon 5      Exon 4   Exon 3      Exon 2   Exon 1   promoter 
   1062B    -6.850727 -10.426573  -7.121629 -9.072209  -5.144233 -8.749631  -7.464106 -8.294435 -5.907707
   1069T    -8.070629  -8.235831  -8.456142 -8.162655  -6.540471 -7.898194  -9.441525 -7.858809 -6.341495
   1078B    -8.351043  -8.629058  -9.052436 -7.652076  -5.822536 -6.629604  -8.810523 -5.912981 -6.051449
   1116B    -6.413303  -7.456374  -6.251024 -6.716293  -6.369380 -6.380853  -6.403044 -6.314320 -6.336989
   1131-1S  -6.237653  -9.621930  -6.160782 -8.447198  -6.310622 -7.476788  -6.296701 -6.970802 -6.410383
   1190T    -6.971004  -7.061738  -6.532381 -6.523190  -6.689861 -6.088864  -7.263789 -6.105003 -6.296208
   1197T    -9.718843  -6.836575  -9.386519 -6.294332  -9.097777 -5.948755 -10.271336 -5.982237 -6.647977
   540B    -10.818276  -7.881994 -11.038090 -7.353217 -11.711860 -6.696325 -11.860648 -6.556610 -5.982021


ugh.boxplot()
plt.show()

1 个答案:

答案 0 :(得分:0)

提供您的数据:

  • 没有提供的信息可以复制的问题
  • 如果使用Jupyter,请重新启动内核并清除所有输出
    • 读回数据
import pandas as pd
import matplotlib.pyplot as plt

Unnamed: 0     Exon 8     Exon 7     Exon 6    Exon 5     Exon 4    Exon 3     Exon 2    Exon 1  promoter
     1062B  -6.850727 -10.426573  -7.121629 -9.072209  -5.144233 -8.749631  -7.464106 -8.294435 -5.907707
     1069T  -8.070629  -8.235831  -8.456142 -8.162655  -6.540471 -7.898194  -9.441525 -7.858809 -6.341495
     1078B  -8.351043  -8.629058  -9.052436 -7.652076  -5.822536 -6.629604  -8.810523 -5.912981 -6.051449
     1116B  -6.413303  -7.456374  -6.251024 -6.716293  -6.369380 -6.380853  -6.403044 -6.314320 -6.336989
   1131-1S  -6.237653  -9.621930  -6.160782 -8.447198  -6.310622 -7.476788  -6.296701 -6.970802 -6.410383
     1190T  -6.971004  -7.061738  -6.532381 -6.523190  -6.689861 -6.088864  -7.263789 -6.105003 -6.296208
     1197T  -9.718843  -6.836575  -9.386519 -6.294332  -9.097777 -5.948755 -10.271336 -5.982237 -6.647977
      540B -10.818276  -7.881994 -11.038090 -7.353217 -11.711860 -6.696325 -11.860648 -6.556610 -5.982021


df.boxplot(figsize=(9, 9))
plt.ylim(-12, -3)

enter image description here