Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Cannot plot go.Choropleth inside dcc.Graph

$
0
0

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

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

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images