
Dynamic zoom on scattermapbox map chart in plotly dash using an interactive plotly data visualization library and dash web library.
Inputs: Drop down list
Dynamic zoom on scattermapbox map chart in plotly dash. Dynamic zoom help us to view an exact location of any region. By selecting any region from the dash input component or drop down list, we can see an exact position of that region on scattermapbox map chart.
We just need to create list in dictionary. See below in the code template lines 11 to 13. View full code using the below link on GitHub.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import pandas as pd cities = pd.read_csv('us-cities-top-1k.csv') cities1 = cities[['State', 'lat', 'lon']] list_locations = cities1.set_index('State')[['lat', 'lon']].T.to_dict('dict') |
Watch the video below how this dashboard work?
Download the full code and CSV data file and learn more about plotly dash on Udemy.