I am currently trying to visualize geographical data for the districts of the city of Hamburg. The creation of the choropleth by using plotly.graph_objects and an associated GeoJSON file is working perfectly fine.
However, as I am plotting the city of Hamburg, it is not possible for me to use one of the specified locationmodes and I have to zoom in manually - for each individual plot, for each execution, which is very cumbersome.
Can I somehow use longitude/latitude coordinates, something like zoom_start similar to Folium, or any other keyword I'm missing to limit the selection programmatically?
For completeness, the code so far is attached (Subplots are created, whereas each subplot is data from a dataframe visualized as a graph_objects.Choropleth instance and can be touched individually (zooming, ...).
import plotly
import plotly.graph_objects as go
choro_overview = plotly.subplots.make_subplots(
rows=6, cols=2, specs=[[{'type': 'choropleth'}]*2]*6,
subplot_titles = df_main.columns[5:],
horizontal_spacing = 0.1,
)
cbar_locs_x = [0.45, 1]
cbar_locs_y = np.linspace(0.95, 0.05, 6)
for ii, column in enumerate(df_main.columns[5:]):
placement = np.unravel_index(ii, (6, 2))
choro_overview.add_trace(
go.Choropleth(
locations = df_main['District'],
z = df_main[column],
geojson=geojson_src,
featureidkey='properties.name',
colorbar=dict(len=np.round(1/9, 1), x=cbar_locs_x[placement[1]], y=cbar_locs_y[placement[0]]),
name=column,
colorscale='orrd',
), row=placement[0]+1, col=placement[1]+1