Skip to content

Commit 0b3645d

Browse files
committed
Update linked-brushing.ipynb
1 parent 115b4f6 commit 0b3645d

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

3-tech-demos/linked-brushing.ipynb

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111
"This notebook demonstrates linked brushing with **Holoviews.selection**.\n"
1212
]
1313
},
14-
{
15-
"cell_type": "code",
16-
"execution_count": null,
17-
"metadata": {},
18-
"outputs": [],
19-
"source": [
20-
"from IPython.core.display import display, HTML\n",
21-
"display(HTML(\"<style>.container { width:100% !important; }</style>\"))"
22-
]
23-
},
2414
{
2515
"cell_type": "code",
2616
"execution_count": null,
@@ -98,6 +88,15 @@
9888
"link_selections(tiles.CartoLight() * map_plot + hist_plot)"
9989
]
10090
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": null,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"map_plot + df.groupby(\"ShipType\").count().hvplot.bar(x=\"ShipType\", y='MMSI', width=400, rot=90)"
98+
]
99+
},
101100
{
102101
"cell_type": "markdown",
103102
"metadata": {},
@@ -126,6 +125,26 @@
126125
"## Datashade"
127126
]
128127
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": null,
131+
"metadata": {},
132+
"outputs": [],
133+
"source": [
134+
"gdf = gpd.read_file('../data/ais.gpkg', rows=100000)\n",
135+
"gdf.loc[:, 'x'], gdf.loc[:, 'y'] = lnglat_to_meters(gdf.geometry.x, gdf.geometry.y)\n",
136+
"df = pd.DataFrame(gdf)"
137+
]
138+
},
139+
{
140+
"cell_type": "code",
141+
"execution_count": null,
142+
"metadata": {},
143+
"outputs": [],
144+
"source": [
145+
"hist_plot = df.where((df.SOG>0) & (df.SOG<50)).hvplot.hist(\"SOG\", bins=20, width=400, height=300) "
146+
]
147+
},
129148
{
130149
"cell_type": "code",
131150
"execution_count": null,
@@ -145,6 +164,15 @@
145164
"link_selections(tiles.CartoLight() * datashade + hist_plot)#.cols(1)"
146165
]
147166
},
167+
{
168+
"cell_type": "code",
169+
"execution_count": null,
170+
"metadata": {},
171+
"outputs": [],
172+
"source": [
173+
"df"
174+
]
175+
},
148176
{
149177
"cell_type": "markdown",
150178
"metadata": {},
@@ -193,7 +221,7 @@
193221
"name": "python",
194222
"nbconvert_exporter": "python",
195223
"pygments_lexer": "ipython3",
196-
"version": "3.7.12"
224+
"version": "3.10.12"
197225
}
198226
},
199227
"nbformat": 4,

0 commit comments

Comments
 (0)