diff --git a/plotly-package/plotly/figure_factory/_county_choropleth.py b/plotly-package/plotly/figure_factory/_county_choropleth.py index d4cb015409e..26f6d7f2cc4 100644 --- a/plotly-package/plotly/figure_factory/_county_choropleth.py +++ b/plotly-package/plotly/figure_factory/_county_choropleth.py @@ -11,6 +11,7 @@ import plotly.colors as clrs from plotly.figure_factory import utils from plotly.exceptions import PlotlyError +import plotly.graph_objs as go pd.options.mode.chained_assignment = None @@ -950,4 +951,4 @@ def create_choropleth(fips, values, scope=['usa'], binning_endpoints=None, fig['layout']['yaxis']['range'][0] = center[1] - new_height * 0.5 fig['layout']['yaxis']['range'][1] = center[1] + new_height * 0.5 - return fig + return go.Figure(fig) diff --git a/plotly-package/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py b/plotly-package/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py index e9c1fa9a662..4dd5b7a01c8 100644 --- a/plotly-package/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py +++ b/plotly-package/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py @@ -2817,7 +2817,7 @@ def test_full_choropleth(self): simplify_county=1 ) - exp_fig_head = [ + exp_fig_head = ( -88.053375, -88.02916499999999, -88.02432999999999, @@ -2868,7 +2868,7 @@ def test_full_choropleth(self): -85.142567, -85.113329, -85.10533699999999 - ] + ) self.assertEqual(fig['data'][2]['x'][:50], exp_fig_head)