diff --git a/source/img/viz/languages_with_mouse.png b/source/img/viz/languages_with_mouse.png new file mode 100644 index 00000000..791ba196 Binary files /dev/null and b/source/img/viz/languages_with_mouse.png differ diff --git a/source/viz.md b/source/viz.md index c7b4d77b..08c6d7d4 100755 --- a/source/viz.md +++ b/source/viz.md @@ -16,6 +16,7 @@ kernelspec: :tags: [remove-cell] from chapter_preamble import * +from IPython.display import Image ``` (viz)= @@ -1065,7 +1066,7 @@ glue('can_lang_plot_theme', can_lang_plot_theme.properties(height=320, width=420 :figwidth: 700px :name: can_lang_plot_theme -Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home colored by language category with color-blind friendly colors. +Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home colored by language category with custom colors. ::: The chart above gives a good indication of how the different language categories differ, @@ -1100,15 +1101,18 @@ can_lang_plot_tooltip = alt.Chart(can_lang).mark_point(filled=True).encode( ```{code-cell} ipython3 :tags: ["remove-cell"] -# Increasing the dimensions makes all the ticks fit in jupyter book (the fit with the default dimensions in jupyterlab) -glue('can_lang_plot_tooltip', can_lang_plot_tooltip.properties(height=320, width=420), display=False) +if 'BOOK_BUILD_TYPE' in os.environ and os.environ['BOOK_BUILD_TYPE'] == 'PDF': + glue('can_lang_plot_tooltip', Image('img/viz/languages_with_mouse.png'), display=False) +else: + # Increasing the dimensions makes all the ticks fit in jupyter book (the fit with the default dimensions in jupyterlab) + glue('can_lang_plot_tooltip', can_lang_plot_tooltip.properties(height=320, width=420), display=False) ``` :::{glue:figure} can_lang_plot_tooltip :figwidth: 700px :name: can_lang_plot_tooltip -Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home colored by language category with color-blind friendly colors. Hover over the data points with the mouse pointer to see additional information. +Scatter plot of percentage of Canadians reporting a language as their mother tongue vs the primary language at home colored by language category with custom colors and mouse hover tooltip. ::: From the visualization in {numref}`can_lang_plot_tooltip`,