Hey everyone,
I was planning to develop a Dash application with using a Turkey choropleth map. But there is a margin on both sides of the choropleth. I tried to adjust parameters and some “css hack” but doesn’t work. It will be OK to remove the legend.
My main goal is placing the map in a card. Just like this:
import pandas as pd
import requests
import plotly.express as px
# Read dataset and preprocess
df = pd.read_csv("https://gist.githubusercontent.com/Akaame/e9aaf3b17f54fba72a1a27a2a555fa82/raw/a93a367722671dbae93d7e06c44e975b6a637015/tr.csv")
df = df[['il', 'nufus']]
repo_url = 'https://raw.githubusercontent.com/alpers/Turkey-Maps-GeoJSON/master/tr-cities.json'
turkey_regions_geo = requests.get(repo_url).json()
fig = px.choropleth(data_frame=df,
geojson=turkey_regions_geo,
locations='il',
featureidkey='properties.name',
color='nufus',
color_continuous_scale="Reds",
scope="europe",
)
fig.update_geos(showcountries=False, showcoastlines=False, showland=False, fitbounds="locations",
projection_rotation=dict(lon=36, lat=0, roll=0))
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
You can check this colab notebook: Google Colab