I was trying to use the create_choropleth
function from figure_factory
following the example plotly provided on their tutorial but kept on getting error messages as listed below.
I've tried installing the plotly-geo
package as well as reinstalling (and re-import) geopandas
, plotly
, pyshp
and shapely
, but nothing seems to work.
Do I need to install/import some other module that I'm unaware of?
I felt it is a very basic question but I just could find any solutions online.
import geopandas
import plotly
import plotly.figure_factory as ff
fips = ['06021', '06023', '06027',
'06029', '06033', '06059',
'06047', '06049', '06051',
'06055', '06061']
values = range(len(fips))
fig = ff.create_choropleth(fips=fips, values=values)
fig.layout.template = None
fig.show()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-239-432834fe2ad7> in <module>
5 values = range(len(fips))
6
----> 7 fig = ff.create_choropleth(fips=fips, values=values)
8 fig.layout.template = None
9 fig.show()
D:\Anaconda3\lib\site-packages\plotly\figure_factory\_county_choropleth.py in create_choropleth(fips, values, scope, binning_endpoints, colorscale, order, simplify_county, simplify_state, asp, show_hover, show_state_data, state_outline, county_outline, centroid_marker, round_legend_values, exponent_format, legend_title, **layout_options)
622
623 $ conda install -c plotly plotly-geo
--> 624 """
625 )
626
ValueError:
The create_choropleth figure factory requires the plotly-geo package.
Install using pip with:
$ pip install plotly-geo
Or, install using conda with
$ conda install -c plotly plotly-geo
111