Fix map display issues on blog output
This commit is contained in:
parent
4ec27ed73b
commit
04bbfb09a5
1 changed files with 38 additions and 13 deletions
51
index.qmd
51
index.qmd
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
title: Nuclear Explosions
|
||||
subtitle: "Using python polars and seaborn to visualize global detonations"
|
||||
description: "Using python polars and seaborn to visualize global detonations"
|
||||
references:
|
||||
- type: techreport
|
||||
id: Bergkvist2000
|
||||
|
@ -16,6 +18,10 @@ references:
|
|||
title: "Nuclear Explosions 1945 - 1998"
|
||||
page: 1-42
|
||||
issn: 1104-9154
|
||||
pubDate: "2024-07-03T18:36:26"
|
||||
weight: 10
|
||||
tags:
|
||||
- python
|
||||
---
|
||||
|
||||
```{python}
|
||||
|
@ -45,7 +51,7 @@ country_colors = {
|
|||
|
||||
```{python}
|
||||
# | label: data-prep
|
||||
# | echo: false
|
||||
# | code-fold: true
|
||||
schema_overrides = (
|
||||
{
|
||||
col: pl.Categorical
|
||||
|
@ -349,8 +355,12 @@ Finally, let's view a map of the world with the explosions marked, separated by
|
|||
::: {.content-visible when-format="html"}
|
||||
Hovering over individual explosions will show their year
|
||||
while a click will open more information in a panel.
|
||||
The map can be seen in @fig-worldmap-html.
|
||||
:::
|
||||
|
||||
::: {.content-visible unless-format="html"}
|
||||
The map can be seen in @fig-worldmap-static.
|
||||
:::
|
||||
The map can be seen in @fig-worldmap.
|
||||
|
||||
```{python}
|
||||
# | label: worldmap-setup
|
||||
|
@ -409,29 +419,44 @@ for country in country_colors.keys():
|
|||
folium.LayerControl().add_to(m)
|
||||
```
|
||||
|
||||
::: {#fig-worldmap}
|
||||
|
||||
:::: {.content-visible when-format="html"}
|
||||
::: {.content-visible when-format="html"}
|
||||
|
||||
```{python}
|
||||
# | label: worldmap-html
|
||||
# | label: fig-worldmap-html
|
||||
# | fig-cap: World map of nuclear explosions, 1945-98
|
||||
m
|
||||
```
|
||||
|
||||
::::
|
||||
:::
|
||||
|
||||
:::: {.content-visible unless-format="html" width=80%}
|
||||
::: {.content-visible unless-format="html" width=80%}
|
||||
|
||||
```{python}
|
||||
# | label: worldmap-non-html
|
||||
# | label: fig-worldmap-static
|
||||
# | fig-cap: World map of nuclear explosions, 1945-98
|
||||
# ENSURE SELENIUM IS INSTALLED
|
||||
m.png_enabled = True
|
||||
m
|
||||
from PIL import Image
|
||||
from IPython.display import Image as IImage
|
||||
import io
|
||||
img = m._to_png()
|
||||
|
||||
bimg = io.BytesIO(img)
|
||||
Image.open(bimg).save("map.png")
|
||||
IImage(url="map.png")
|
||||
```
|
||||
|
||||
::::
|
||||
:::
|
||||
|
||||
World map of nuclear explosions, 1945-98
|
||||
::: {.callout-warning .content-visible when-format="markdown"}
|
||||
Interactive maps not working
|
||||
|
||||
Unfortunately, as of right now folium maps rendered within a quarto document do
|
||||
not seem to translate terribly well into an astro blog such as this.
|
||||
This is why, for now, there is only a static image here.
|
||||
|
||||
This is very sad, but for the time being feel free to download and peruse
|
||||
the ipynb notebook [here](./index.ipynb), or the [pdf](./index.pdf)
|
||||
or [docx](./index.docx) versions.
|
||||
:::
|
||||
|
||||
While there are undoubtedly more aspects of the data that provide interesting
|
||||
|
|
Loading…
Reference in a new issue