在Seaborn中将ci和x_ci参数与regplot一起使用

时间:2018-10-01 06:35:14

标签: python matplotlib seaborn

当我不使用相关参数 ci x_ci 而是使用 regplot()函数绘制置信区间时,我感到困惑一旦使用它们,置信区间就会消失。

有关可重现的示例:

toy_data # json format
'{"REGION":{"3041":2,"1335":5,"6261":8,"548":7,"4471":8,"3226":5,"5601":5,"1141":4,"1175":4,"1825":5,"5038":4,"3767":5,"1536":1,"168":5,"6247":6,"31":5,"1107":3,"5067":6,"985":3,"6176":5,"3415":6,"3013":2,"4785":1,"2676":3,"228":8,"5807":7,"530":7,"4678":5,"1062":3,"1698":3,"6648":3,"4686":5,"571":7,"760":5,"5178":9,"6090":8,"4945":2,"5636":7,"490":8,"1734":4,"3012":2,"14":5,"4637":2,"3239":4,"5866":2,"5297":4,"3011":2,"612":1,"1137":4,"1384":5,"3194":5,"632":2,"3820":3,"3923":9,"6580":3,"3870":9,"5952":5,"6423":5,"1101":3,"4622":6,"975":3,"1954":7,"4515":3,"1252":4,"457":8,"4712":1,"4446":6,"788":5,"2392":2,"704":5,"2378":2,"547":7,"115":6,"3703":8,"1949":7,"5852":8,"1468":2,"1680":3,"471":8,"750":5,"2605":3,"3974":6,"3029":2,"1237":4,"1521":1,"2543":5,"5907":6,"5782":4,"5974":5,"4070":9,"1838":5,"3880":9,"1938":4,"2596":4,"6533":2,"2941":2,"6160":2,"3572":7,"2326":2,"1355":5},"Tuition":{"3041":20825.0,"1335":10948.0,"6261":null,"548":14144.0,"4471":8622.0,"3226":14190.0,"5601":12897.0,"1141":23799.0,"1175":13141.0,"1825":2372.0,"5038":null,"3767":3732.0,"1536":null,"168":19143.0,"6247":9804.0,"31":8000.0,"1107":20203.0,"5067":null,"985":12334.0,"6176":8459.0,"3415":6561.0,"3013":13496.0,"4785":20544.0,"2676":32395.0,"228":13328.0,"5807":21132.0,"530":8212.0,"4678":15113.0,"1062":17176.0,"1698":17596.0,"6648":null,"4686":null,"571":14405.0,"760":4987.0,"5178":15505.0,"6090":15685.0,"4945":23896.0,"5636":13710.0,"490":5906.0,"1734":22306.0,"3012":21284.0,"14":4499.0,"4637":25300.0,"3239":19052.0,"5866":null,"5297":10399.0,"3011":11401.0,"612":35653.0,"1137":19869.0,"1384":15669.0,"3194":18833.0,"632":22675.0,"3820":21771.0,"3923":7139.0,"6580":null,"3870":10359.0,"5952":null,"6423":null,"1101":15326.0,"4622":21863.0,"975":4613.0,"1954":12967.0,"4515":9531.0,"1252":18609.0,"457":2140.0,"4712":22745.0,"4446":8585.0,"788":11430.0,"2392":18870.0,"704":28870.0,"2378":null,"547":null,"115":12977.0,"3703":12633.0,"1949":8881.0,"5852":23186.0,"1468":29049.0,"1680":7137.0,"471":null,"750":6894.0,"2605":3283.0,"3974":5282.0,"3029":18048.0,"1237":6355.0,"1521":29464.0,"2543":6558.0,"5907":11972.0,"5782":17544.0,"5974":5769.0,"4070":3452.0,"1838":4592.0,"3880":7932.0,"1938":6861.0,"2596":2265.0,"6533":null,"2941":34857.0,"6160":null,"3572":11571.0,"2326":34945.0,"1355":19308.0}}'

sns.regplot(data= toy_data,
            y='Tuition',
            x="REGION",
            x_estimator=np.mean,

        )

plt.show()
plt.clf()

enter image description here

sns.regplot(data= toy_data,
            y='Tuition',
            x="REGION",
            x_estimator=np.mean,
            x_ci = 10,
            ci = 10
        )

plt.show()
plt.clf()

enter image description here

您的建议将不胜感激。

0 个答案:

没有答案