Matplotlib意外生成的带缺口的箱形图,Seaborn错误

使用sklearn,并尝试使用matplotlib绘制箱形图。

nps = np.array(all_s)npd = [dd for dd in all_d]plt.boxplot(nps.T, npd)plt.show()

enter image description here

但结果出现了缺口,上下界也显示得有些奇怪。此外,当我尝试在Seaborn中绘图时,得到以下错误: Buffer has wrong number of dimensions (expected 1, got 2)我在这里错过了什么?

编辑:添加数据

all_d = range(1,11)    all_s =    [[0.31111111111111112,      0.38333333333333336,      0.2722222222222222,      0.29999999999999999,      0.32222222222222224,      0.32777777777777778,      0.3888888888888889,      0.36312849162011174,      0.37430167597765363,      0.37430167597765363],     [0.57222222222222219,      0.6333333333333333,      0.6166666666666667,      0.62777777777777777,      0.68333333333333335,      0.62777777777777777,      0.69444444444444442,      0.61452513966480449,      0.6033519553072626,      0.6033519553072626],     [0.73333333333333328,      0.82222222222222219,      0.68888888888888888,      0.7055555555555556,      0.77777777777777779,      0.73333333333333328,      0.81666666666666665,      0.73743016759776536,      0.72625698324022347,      0.72067039106145248],     [0.81666666666666665,      0.89444444444444449,      0.87222222222222223,      0.87777777777777777,      0.87777777777777777,      0.78888888888888886,      0.85555555555555551,      0.84916201117318435,      0.84916201117318435,      0.82681564245810057],     [0.90555555555555556,      0.93888888888888888,      0.87777777777777777,      0.91666666666666663,      0.90555555555555556,      0.87222222222222223,      0.90555555555555556,      0.88268156424581001,      0.87709497206703912,      0.8994413407821229],     [0.89444444444444449,      0.97222222222222221,      0.83888888888888891,      0.91666666666666663,      0.89444444444444449,      0.84444444444444444,      0.92777777777777781,      0.92737430167597767,      0.8938547486033519,      0.92178770949720668],     [0.90555555555555556,      0.96111111111111114,      0.93888888888888888,      0.91666666666666663,      0.91666666666666663,      0.90000000000000002,      0.93333333333333335,      0.95530726256983245,      0.8994413407821229,      0.92737430167597767],     [0.90555555555555556,      0.96111111111111114,      0.92222222222222228,      0.92222222222222228,      0.91666666666666663,      0.93888888888888888,      0.93333333333333335,      0.96648044692737434,      0.92737430167597767,      0.92737430167597767],     [0.93333333333333335,      0.97777777777777775,      0.94999999999999996,      0.93888888888888888,      0.94444444444444442,      0.97777777777777775,      0.94999999999999996,      0.98882681564245811,      0.95530726256983245,      0.94413407821229045],     [0.91666666666666663,      0.97777777777777775,      0.94999999999999996,      0.94444444444444442,      0.92777777777777781,      0.98333333333333328,      0.94999999999999996,      0.97765363128491622,      0.96089385474860334,      0.94413407821229045]]

回答:

我最终解决了这个问题!感谢BrenBarn指出.boxplot的第二个参数是notch。我做了以下操作:

nps = np.array(all_s)npd = [dd for dd in all_d]box=sns.boxplot(data=nps.T) box.set_xticklabels(npd)plt.show()

enter image description here

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注