Skip to content

[BUG]: Odd polygon in land layer, extending into Canada on US choropleth #5685

Description

@GrantLS

Description

There is an odd band extending from the northwest US into Canada when making a US choropleth. You can see this in the official documentation. I think this stems from the GeoJSON file included in Plotly. The file is very out of date, by the way, with changes to Oglala Lakota County in South Dakota and the Kusilvak Census Area in Alaska not being represented.

I can hide this band in the Python version using visible=False when calling update_geos().

Screenshots/Video

Image

Steps to reproduce

Notes

The unemployment example is here for completeness' sake:

from urllib.request import urlopen
import json
with urlopen('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json') as response:
    counties = json.load(response)

import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/fips-unemp-16.csv",
                   dtype={"fips": str})

import plotly.express as px

fig = px.choropleth(df, geojson=counties, locations='fips', color='unemp',
                           color_continuous_scale="Viridis",
                           range_color=(0, 12),
                           scope="usa",
                           labels={'unemp':'unemployment rate'}
                          )
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions