State boundaries on a world map projection?


#1

Out of all (I think I tried most or all) of the projections on https://plot.ly/python/reference/#layout-geo-projection only “albers usa” showed us state lines.

Is it possible to have state lines on other projections? I want to be able to see the world map and also have state borders. I already have “showsubunits” set to True


#2

Hey @JuanPotato

Unfortunately it isn’t possible to show state boundaries on locations other than US. That said, if you’re not married to the use of geo trace types, you could consider using mapbox https://plot.ly/python/mapbox-county-choropleth/ and your own boundaries data.


#3

Is it possible to merge the projections so you could have just the USA state boundaries + the world country boundaries?


#4

Yes, you could use have multiple traces. Something like:

{
    'data': [
        {
            'type': 'choropleth',
            'locations': df['location-a'],
            'z': df['z-a'],
            'locationmode': 'ISO-3',
            ...
        },
        {
            'type': 'choropleth',
            'locations': df['location-b'],
            'z': df['z-b'],
            'locationmode': 'USA-states',
            ...
        }
    ],

    'layout': {
        'geo': {
            'scope': 'world',
            'projection': {
                'type': 'orthographic'
            }
        }
    }
}