Update_geos conflict with px.scatter_mapbox?

New to plotly, I’m trying drawing a scatter_map. For some reason, I want to cancel the country border by the code as follows:

fig = px.scatter_mapbox(
        df, lat="lat", lon="lon", color="var_c", size='var_s',
        custom_data=['city', 'var_c', 'var_s'],
        mapbox_style="open-street-map", 
        center=dict(lat=34.3227, lon=108.5525), 
        zoom=3
    )
fig.update_geos(
        showcountries=False
    )

But only the px.scatter_mapbox works and coutry boundaries have not be deleted.
While I use go.Scattergeo(), It works:

fig = go.Figure(go.Scattergeo())
fig.update_geos(
        showcountries=False
    )

I want to know whether update_geos conflict with px.scatter_mapbox(according to offical tutorial, they don’t conflict), and how can I fix it?
Thanks in advance.

If you create a fig returned by px.scatter_mapbox, then printing fig.layout you’ll notice
that there is a layout property, mapbox, not geo. Hence you may not update geo attributes here.

1 Like

I solved this question, @empet is right, px.scatter_mapbox can’t be changed by update_geos. And if anyone else want to change the style of mapbox, there is my solution:

fig.update_layout(
        mapbox=dict(
            accesstoken=mapbox_access_token,
            style='mapbox://styles/your_customed_style'
        )
    )

mapbox_access_token is a string defined before, it’s your own mapbox token, you can get it through https://docs.mapbox.com/ .
And you can create a new style of mapbox (Create a custom style | Help | Mapbox may helps), to delete country boundary, to change themes of map, or do anything you want to do.