Cannot plot go.Choropleth inside dcc.Graph

Hi, I’m trying to plot a go.Choropleth map inside a figure fed to dcc.Graph.

Unfortunately, the map is not showed and I’m faced with a grid kind of graph typically used for scatter plots (as per the image below).

I’m running Dash 1.12.0 with Pyplot 4.7.1 (the most up-to-date versions in Python3 pip). The map is displayed correctly when using

Am I missing something? Is there some problem with the current version of dash?
Thank you

def plot_country_map():

	df = pd.read_csv('countries.csv')
	map_fig = go.Figure(data=go.Choropleth(
		locations = df['country_codes'],
		z = df['country_measurements'],
		text = df['country_names'],
		colorscale = 'Reds',
		colorbar_title = 'Measurements',

		title_text = 'Measured Countries',
		geo = dict(
			resolution = 50,
			projection_type = "miller",
			lataxis = dict(
				range = [-60, 90], #Clip Antarctica

	map_plot = dcc.Graph(id='country_maps',figure=map_fig)

	return map_plot

Hi @dmbb93
Do you have an app.layout section in your code?

Hi @adamschroeder! I do have one, yes.

The layout for this page is inside html.Div(getHomepage())

where getHomepage() is:

def getHomepage():

	elems = [
		html.P("Here is the map"),
	return elems

I have a few different pages using dcc.Graph() to plot scatter and bar plots, with a similar layout organization. However, it seems like dcc.Graph() is not updating the figure field when I use go.Choropleth().

Thank you!

that’s weird. If you are using dcc.grpah() to plot scatter and bar plots, then it should plot go.choropleth(). Have you tried plotting go.choropleth on it’s own, without using Dash? Just plug the data into go.choropleth and try to plot it using only plotly with If that works, then you know the problem is not with plotly or your data, but with the connection between Dash and the graph.

I did try that, and go.choropleth works fine on its own when not using Dash:

It really looks like it’s something to do with the Plotly-Dash connection