choropleth

Choropleth map with plotly

Choropleth map with plotly Question: I’m trying to make a choropleth map with folium and with plotly in python. The data is from CBS: https://www.cbs.nl/nl-nl/onze-diensten/open-data/statline-als-open-data/cartografie. The folium choropleth works, but the plotly choropleth doesn’t. The legend is showing, but the map is not. What am I doing wrong? #Make choropleth map with folium and with …

Total answers: 1

How to fix the scale of several choropleth maps?

How to fix the scale of several choropleth maps? Question: I am creating multiple choropleth maps for different time frames (because I want to do a gif) and wondering if there is any way to fix the scale for each map to do easy visual comparison ? My current code is as follows years = …

Total answers: 1

Plotly – set decimal place in choropleth

Plotly – set decimal place in choropleth Question: How do you convert number 1.425887B to 1.4 in plotly choropleth ? data2022 = dict(type = ‘choropleth’, colorscale = ‘agsunset’, reversescale = True, locations = df[‘Country/Territory’], locationmode = ‘country names’, z = df[‘2022 Population’], text = df[‘CCA3’ ], marker = dict(line = dict(color = ‘rgb(12, 12, 12)’, …

Total answers: 2

How to Combine a Slider with a Drop Down for Plotly Choropleth?

How to Combine a Slider with a Drop Down for Plotly Choropleth? Question: How do I combine a slider and button/drop down in a choropleth to work correctly? I am trying to create a choropleth of US states where the colors represent median home sale price for a given date, slider, and property type, drop …

Total answers: 1

Issues using Choropleth

Issues using Choropleth Question: Currently trying to learn cloropleth – fairly a noob with this. Problem: I’m currently using a Michigan Counties GeoJSON file and am trying to draw a map of the state showcasing the percentage of people that opted for John. In return though, I only get an empty colorless map of the …

Total answers: 1

Plotly choropleth can't read State iso codes

Plotly choropleth can't read State iso codes Question: I want to visualize the number of crimes by state using plotly express. This is the code : import plotly.express as px fig = px.choropleth(grouped, locations="Code", color="Incident", hover_name="Code", animation_frame=’Year’, scope=’usa’) fig.show() The dataframe itself looks like this: I only get blank map: What is the wrong with …

Total answers: 1

How to generate a choropleth map based on region names?

How to generate a choropleth map based on region names? Question: I’m working on Python with a dataset that has data about a numerical variable for each italian region, like this: import numpy as np import pandas as pd regions = [‘Trentino Alto Adige’, "Valle d’Aosta", ‘Veneto’, ‘Lombardia’, ‘Emilia-Romagna’, ‘Toscana’, ‘Friuli-Venezia Giulia’, ‘Liguria’, ‘Piemonte’, ‘Marche’, …

Total answers: 1

Why is my choropleth not showing anything?

Why is my choropleth not showing anything? Question: I want to show a map of the police deaths by states in the US. Here is my code : import pandas as pd #manipulation des donnees import plotly.express as px file="../data/PoliceDeaths.csv" data = pd.read_csv(file, index_col=None) df = pd.read_csv(‘deathbystate.csv’, index_col=None) state_data = pd.DataFrame() state_data = data.state.value_counts().rename_axis(‘state_code’).reset_index(name=’number_of_deaths’) print(state_data) …

Total answers: 1

adjust the size of the text label in plotly

adjust the size of the text label in plotly Question: Im trying to adjust the text size accoridng to country size, so the text will be inside the boardes of the copuntry. import pandas as pd import plotly.express as px df=pd.read_csv(‘regional-be-daily-latest.csv’, header = 1) fig = px.choropleth(df, locations=’Code’, color=’Track Name’) fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) fig.add_scattergeo( locations = df[‘Code’], …

Total answers: 2

Text as tooltip, popup or labels in folium choropleth GeoJSON polygons

Text as tooltip, popup or labels in folium choropleth GeoJSON polygons Question: Folium allow to create Markers with tooltip or popup text. I would like to do the same with my GeoJSON polygons. My GeoJSON has a property called "name" (feature.properties.name -> let’s assume it is the name of each US state). I would like …

Total answers: 2