plotly.figure_factory.create_scatterplot 停止工作?

plotly.figure_factory.create_scatterplot stopped working?

我正在使用 plotly 尝试一些东西,然后发现 create_scatterplot 是唯一不起作用的包。 我的意思是,它显然在模块中,正如您调用帮助命令时显示的那样:

NAME
plotly.figure_factory

FILE
     /usr/lib/python2.7/site-packages/plotly/figure_factory/__init__.py

 PACKAGE CONTENTS
    _2d_density
    _annotated_heatmap
    _bullet
    _candlestick
    _county_choropleth
    _dendrogram
    _distplot
    _facet_grid
    _gantt
    _ohlc
    _quiver
    _scatterplot
    _streamline
    _table
 :

And in the plotly.py/plotly/figure_factory github folder

是挂了还是怎么了?我对编程很陌生,但我认为这种事情留在本地。也许我丢失了一些东西,我可以解决这个问题吗?

如果你想检查一些代码:

from plotly import figure_factory as ff
help(ff)
from plotly.figure_factory import create_2d_density
from plotly.figure_factory import create_annotated_heatmap
from plotly.figure_factory import create_bullet
from plotly.figure_factory import create_candlestick
from plotly.figure_factory import create_county_choropleth
from plotly.figure_factory import create_dendrogram
from plotly.figure_factory import create_facet_grid
from plotly.figure_factory import create_gantt
from plotly.figure_factory import create_ohlc
from plotly.figure_factory import create_quiver
from plotly.figure_factory import create_scatterplot
from plotly.figure_factory import create_streamline
from plotly.figure_factory import create_table

您只能看到 returns 散点图错误和 county_choropleth。

正如我在 github plotly.figure_factory at _county_choropleth 中看到的那样,您只需以另一种方式调用它:

from plotly.figure_factory._county_choropleth import create_choropleth

并在之后调用:

fig = create_choropleth(bla-bla)
py.plot(fig, filename='basic-choropleth')

scatterplot 的情况下,您需要将 create_scatterplot 重命名为 scatterplot:

from plotly.figure_factory._scatterplot import scatterplot

和:

fig = scatterplot(bla-bla)
py.plot(fig, filename='basic-scatter')

我还发现当你调用create_choropleth时你需要安装几个包link以避免麻烦:

pip install shapely
pip install geopandas
pip install pyshp

别忘了更新你的剧情版本:

pip install --upgrade plotly

希望这些信息对您有所帮助