66 extension : .md
77 format_name : markdown
88 format_version : ' 1.2'
9- jupytext_version : 1.5.1
9+ jupytext_version : 1.4.2
1010 kernelspec :
1111 display_name : Python 3
1212 language : python
@@ -20,14 +20,14 @@ jupyter:
2020 name : python
2121 nbconvert_exporter : python
2222 pygments_lexer : ipython3
23- version : 3.7.4
23+ version : 3.7.7
2424 plotly :
2525 description : How to make a map with Hexagonal Binning of data in Python with Plotly.
26- display_as : scientific
26+ display_as : maps
2727 language : python
2828 layout : base
2929 name : Hexbin Mapbox
30- order : 7
30+ order : 13
3131 page_type : u-guide
3232 permalink : python/hexbin-mapbox/
3333 redirect_from : python/hexbin-mapbox/
@@ -55,7 +55,7 @@ fig.update_layout(margin=dict(b=0, t=0, l=0, r=0))
5555fig.show()
5656```
5757
58- #### Count Hexbin with Minimum Count
58+ #### Count Hexbin with Minimum Count and Opacity
5959
6060``` python
6161import plotly.figure_factory as ff
@@ -66,13 +66,13 @@ df = px.data.carshare()
6666
6767fig = ff.create_hexbin_mapbox(
6868 data_frame = df, lat = " centroid_lat" , lon = " centroid_lon" ,
69- nx_hexagon = 10 , opacity = 0.9 , labels = {" color" : " Point Count" },
69+ nx_hexagon = 10 , opacity = 0.5 , labels = {" color" : " Point Count" },
7070 min_count = 1 ,
7171)
7272fig.show()
7373```
7474
75- #### Display the Underlying Data
75+ #### Display the Underlying Data
7676
7777``` python
7878import plotly.figure_factory as ff
@@ -83,7 +83,7 @@ df = px.data.carshare()
8383
8484fig = ff.create_hexbin_mapbox(
8585 data_frame = df, lat = " centroid_lat" , lon = " centroid_lon" ,
86- nx_hexagon = 10 , opacity = 0.9 , labels = {" color" : " Point Count" },
86+ nx_hexagon = 10 , opacity = 0.5 , labels = {" color" : " Point Count" },
8787 min_count = 1 , color_continuous_scale = " Viridis" ,
8888 show_original_data = True ,
8989 original_data_marker = dict (size = 4 , opacity = 0.6 , color = " deeppink" )
@@ -96,6 +96,7 @@ fig.show()
9696``` python
9797import plotly.figure_factory as ff
9898import plotly.express as px
99+ import numpy as np
99100
100101px.set_mapbox_access_token(open (" .mapbox_token" ).read())
101102df = px.data.carshare()
@@ -113,6 +114,7 @@ fig.show()
113114``` python
114115import plotly.figure_factory as ff
115116import plotly.express as px
117+ import numpy as np
116118
117119px.set_mapbox_access_token(open (" .mapbox_token" ).read())
118120df = px.data.carshare()
@@ -138,7 +140,7 @@ np.random.seed(0)
138140N = 500
139141n_frames = 12
140142lat = np.concatenate([
141- np.random.randn(N) * 0.5 + np.cos(i / n_frames * 2 * np.pi)
143+ np.random.randn(N) * 0.5 + np.cos(i / n_frames * 2 * np.pi) + 10
142144 for i in range (n_frames)
143145])
144146lon = np.concatenate([
@@ -152,6 +154,7 @@ frame = np.concatenate([
152154fig = ff.create_hexbin_mapbox(
153155 lat = lat, lon = lon, nx_hexagon = 15 , animation_frame = frame,
154156 color_continuous_scale = " Cividis" , labels = {" color" : " Point Count" , " frame" : " Period" },
157+ opacity = 0.5 , min_count = 1 ,
155158 show_original_data = True , original_data_marker = dict (opacity = 0.6 , size = 4 , color = " deeppink" )
156159)
157160fig.update_layout(margin = dict (b = 0 , t = 0 , l = 0 , r = 0 ))
0 commit comments