Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions chapters/slides-posters-figures.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,21 @@ Show both when the shape of the surface matters.
but PDF and Word output show no interactive plot,
so also provide a static view at a fixed angle
(see [Make figures accessible](teaching.qmd#make-figures-accessible)).
- In a Python tab, draw the interactive 3D plot with [plotly](https://plotly.com/python/3d-charts/) too,
so the R and Python tabs of a figure look alike.
Keep the `matplotlib` version for the PDF and Word output,
where it is the static view at a fixed angle,
and run it only in those outputs, the way the R tab runs its plotly code only in HTML output.
In a `knitr` chunk, print the figure as one raw HTML block under `results: asis`,
because `fig.show()` needs `ipython` and several `print` calls split the chunk's output:

````python
print("```{=html}\n" + fig.to_html(full_html=False, include_plotlyjs="cdn") + "\n```")
````

End each call that returns the figure, such as `add_trace` and `update_layout`, with `;`
so that reticulate does not print the figure after every call,
and add `plotly` to the page's `reticulate::py_require` list.
- Give a 3D plot alt text that states what the surface looks like, such as "a bowl with its lowest point at ...".

::: {.callout-note collapse="true" title="Source"}
Expand Down
Loading