Skip to content
Snippets Groups Projects
Verified Commit dc3acf99 authored by Alexander Dunkel's avatar Alexander Dunkel
Browse files

fix: exported HTML does not automatically resize to full height

parent 120ad7fb
No related branches found
No related tags found
No related merge requests found
......@@ -1032,45 +1032,46 @@ cluster_layer = gv_shapes.opts(
Have a look at the generated interactive html [here](/files/workshop_repo/notebooks/out/heatmap_freq_grass-nature-park.html)
```python
layer_options = {
"responsive":True,
"title":f"Frequentation surface for topic {topic}",
"hooks":[set_active_tool],
"data_aspect":0.6,
"xlim":(gg_bottomleft[0], gg_topright[0]),
"ylim":(gg_bottomleft[1], gg_topright[1])
}
```
```python
gv_layers = hv.Overlay(
bg_layer * \
all_photos_layer * \
contours_layer * \
topic_layer * \
cluster_layer).opts(
responsive=True,
title=f"Frequentation surface for topic {topic}",
hooks=[set_active_tool],
data_aspect=0.6, # either set aspect ratio
# height=700, # or a fixed height
xlim=(gg_bottomleft[0], gg_topright[0]),
ylim=(gg_bottomleft[1], gg_topright[1])
)
gv_layers
cluster_layer)
```
View inline
```python
gv_layers.opts(**layer_options)
```
Unset `data_aspect` for automatic resize to full browser height, then export to standalone HTML:
```python
layer_options["data_aspect"] = None
```
Save to external HTML.
```python
hv.save(
gv_layers,
gv_layers.opts(**layer_options),
OUTPUT / f'heatmap_freq_{topic}.html', backend='bokeh')
```
<div class="alert alert-info" role="alert" style="color: black;">
<details><summary><strong>Optionally Modify <code>data_aspect</code></strong></summary>
<div style="width:500px">
<ul>
<li>Because we're using explicit x-y-lim parameter, <a href="http://holoviews.org/user_guide/Plotting_with_Bokeh.html#Responsive">we need to specify</a> the <code>data_aspect</code> parameter, to stretch the output map to max width and a certain height</li>
<li>Depending on you data-area-rectangle, you may need to modify the parameter so that the height of the output map does not stretch beyond typical screen sizes</li>
<li>Smaller <code>data_aspect</code> values will result in a reduced height of the map</li>
<li>Alternatively, you can also remove <code>data_aspect</code> and use the <code>min_height</code> <a href="https://holoviews.org/user_guide/Annotators.html#Basics">parameter</a> (e.g.: <code>min_height=600</code>)</li>
</ul>
</div>
</details></div>
## Export as Shapefile(s)
Data interchange is critical. Export Contours and other data used here as Shapefiles (UTM Zone 33N).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment