# Cannot plot go.Choropleth inside dcc.Graph

**URL:** <https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516>\
**Category:** Dash Python\
**Created:** [May 15, 2020, 7:48pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516 "2020-05-15T19:48:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmbb93](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@dmbb93](https://community.plotly.com/u/dmbb93)\
**Post date:** [May 15, 2020, 7:48pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/1 "2020-05-15T19:48:40Z")

</div>

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 map\_fig.show().

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

```auto
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',
		autocolorscale=False,
		marker_line_color='darkgray',
		marker_line_width=0.5,
		colorbar_title = 'Measurements',
	))

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

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

	return map_plot

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/7/7eb4933d74e571b0fffaff35cc605d3af663c87e.png)

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [May 15, 2020, 9:55pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/2 "2020-05-15T21:55:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmbb93](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@dmbb93](https://community.plotly.com/u/dmbb93)\
**Post date:** [May 15, 2020, 10:24pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/3 "2020-05-15T22:24:38Z")

</div>

Hi @adamschroeder! I do have one, yes.

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

where `getHomepage()` is:

```auto
def getHomepage():

	elems = [
		html.P("Here is the map"),
		plot_country_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!

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [May 16, 2020, 2:22am UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/4 "2020-05-16T02:22:31Z")

</div>

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 map\_fig.show(). If that works, then you know the problem is not with plotly or your data, but with the connection between Dash and the graph.

---

<div class="post-metadata">

**Author:** ![dmbb93](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@dmbb93](https://community.plotly.com/u/dmbb93)\
**Post date:** [May 16, 2020, 3:30am UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/5 "2020-05-16T03:30:19Z")

</div>

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

 ![Screen Shot 2020-05-15 at 11.29.12 PM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/8557613a4d7997b7869fac6e8cd737ca93d811db.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Colin\_McC-GCS](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@Colin\_McC-GCS](https://community.plotly.com/u/Colin_McC-GCS)\
**Post date:** [July 7, 2026, 4:23pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/6 "2026-07-07T16:23:18Z")

</div>

I’m having a similar issue where when I run my callback, the go.Choroplethmap can be created on the first run, but is not updated on subsequent callbacks. However I have a go.Densitymap that is successfully updating every callback. Including Fig.show() is creating a figure that changes on each callback.

Do you have updates on how you got this working later?

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [July 8, 2026, 4:09pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/7 "2026-07-08T16:09:05Z")

</div>

@Colin_McC-GCS  
can you please share a minimal reproducible example so we can run your code locally and reproduce the error you’re getting?

---

<div class="post-metadata">

**Author:** ![Colin\_McC-GCS](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@Colin\_McC-GCS](https://community.plotly.com/u/Colin_McC-GCS)\
**Post date:** [July 9, 2026, 7:43pm UTC](https://community.plotly.com/t/cannot-plot-go-choropleth-inside-dcc-graph/39516/8 "2026-07-09T19:43:23Z")

</div>

The issue has resolved itself. I cannot replicate it on my original code nor with a modified version. Not sure what, if anything, has changed since then. The only thing I can think of is that clearing my browser’s cache may have fixed it.
