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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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