✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Scattergeo Plots Offline?


This is my first post, I’m not sure of the format of topics on this site just yet.

I’m working in a completely offline environment utilizing Plotly with Python to make some plots. I have come across an issue regarding Map Plots. I have made a Scattergeo plot and the figure never seems to render.

Here’s some example code:

import plotly
import plotly.graph_objects as go
import numpy as np
import pandas as pd
from plotly.offline import plot

fig = go.Figure()
size = 50
#Data Creation
d = {'Lat':np.random.randint(90,120,size),
df = pd.DataFrame(d)

fig.add_trace(go.Scattergeo(mode = "markers+lines",lon = df['Lon'],lat = df['Lat'],marker = {'size': 10,'color':df['colorcode'],'colorscale':'jet','colorbar_thickness':20}))
fig.update_layout(  geo = dict(
                    showland = True,
                    showcountries = True,
                    showocean = True,
                    countrywidth = 0.5,
                    landcolor = 'rgb(230, 145, 56)',
                    lakecolor = 'rgb(0, 255, 255)',
                    oceancolor = 'rgb(0, 255, 255)',
                    projection = dict(
                        type = 'orthographic',
                    lonaxis = dict(
                        showgrid = True,
                        gridcolor = 'rgb(102, 102, 102)',
                        gridwidth = 0.5
                    lataxis = dict(
                        showgrid = True,
                        gridcolor = 'rgb(102, 102, 102)',
                        gridwidth = 0.5

Whenever I run this code, the figure attempts to pop up in a browser, but the figure never renders. I have noticed that there are references to “http://www.w3.org” in the HTML. Is there a way to make these plots with complete offline support?

If scattergeo is not the way to go, then is there another plot that I can do to achieve the same result?

I have tried to create other plot types, and they seem to work fine.

Any suggestions would be greatly appreciated.

Hi @carlmarl,

Welcome to Plotly forum!! What Plotly version are you running?
With the last one (4.8.1) your code works.


Hi empet,

I am using version 4.7.1. It is the latest version included in Anaconda afaik. Do you believe that this would cause issue? Also, is there any way to make plotly get rid of any external references in the HTML?

There is no reason to not work with 4.7.1.

It still does not seem to work. Is there any way to get those links that are in the html code to point to local svgs?

I guess I should caveat this by saying that the colorbar and title render, but the map itself does not.

I’m able to recreate what I see on our network on a network with a connection. It has to do with the topojsonURL in the config.

If you do the following plot call, you will see what I see.


So, I have found some posts related to my issue, but I’m unable to understand them.

Here is the first Link.

So, I have saved the json file that is hosted on cdn.plot.ly/world_110m.json to a local directory, for examples sake say I saved it in C:\MyJson\world_110m.json .

In that post the reply states that the file might need to hosted on a server, so I host the directory C:\MyJson on port 8000 so that I can view the json at and do

I used the following command to setup the simple http server:

python -m SimpleHTTPServer 8000

inside the C:\MyJson directory.


I have also tried


but neither of these work. Now that I’ve learned that there is a topojsonURL in the HTML, I’ve noticed too that there is a topojsonName, however, I do not see the ‘world_110m.json’ set to any variable.

I have tried to add ‘topojsonName’ in the config dictionary, however, there isn’t an option to do that. It doesn’t seem to exist in the config: here

I cannot seem to change the topojsonName, is there any way to do that in python? Also, am I on the right track to getting this to work?


I have the python simple server setup like above, and it is outputting the following: - - [08/Jun/2020 15:20:12] “GET /world_110m.json HTTP/1.1” 200 -

which seems like it is requesting the correct file, however, the plot is still not rendering… I’m lost.


I still haven’t found any way to make any progress.

I have figured out the issue. Turns out that the python simple HTTP server will not work because there is a cross origin issue. Best to serve the world_{resolution}.json files using Flask and returning a JSON.dumps of the file. This will make the plots work.