Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将Seaborn distplot代码更新为0.11版_Python_Seaborn - Fatal编程技术网

Python 将Seaborn distplot代码更新为0.11版

Python 将Seaborn distplot代码更新为0.11版,python,seaborn,Python,Seaborn,使用distplot绘制直方图 sns.distplot(a, color="red", label="100% Equities") 在Seaborn版本0.11或更高版本下运行此命令会产生一个警告,即distplot将被弃用,并改为使用Displat 使用displat作为直接替换(只需将函数名从distplot更改为displat)不会产生相同的直方图 替换代码是什么?使用 histplot而不是distplot 并添加关键字argskde=Tr

使用distplot绘制直方图

sns.distplot(a, color="red", label="100% Equities")
在Seaborn版本0.11或更高版本下运行此命令会产生一个警告,即distplot将被弃用,并改为使用Displat

使用displat作为直接替换(只需将函数名从distplot更改为displat)不会产生相同的直方图

替换代码是什么?

使用

  • histplot
    而不是
    distplot
  • 并添加关键字args
    kde=True,stat=“density”,linewidth=0
因此:

取代

sns.distplot(a, color="red", label="100% Equities")

label似乎不是displat的参数:上面的代码用于distplot(不是displat)。distplot是不推荐使用的代码,它确实有一个标签。此外,histplot(请参见下面的答案)也会从条形图继承标签。如果在给定的链接中向下搜索KWARG(选择histplot,然后在最后的选择栏--您会发现label关键字可用。)Matplotlib执行大量继承:-)顺便说一句,这是尝试使用不推荐使用的代码时发出的警告消息<代码>未来警告:`distplot`是一个不推荐使用的函数,将在将来的版本中删除。请调整您的代码以使用“dislot”(具有类似灵活性的图形级函数)或“histplot”(柱状图的轴级函数)。
sns.distplot(a, color="red", label="100% Equities")