-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from cct-datascience/gganim
Add gganimate slides
- Loading branch information
Showing
13 changed files
with
116 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
_freeze/2024/03-extensions/slides-gganimate/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"hash": "c113ce04074280222242a4df9cb19c6c", | ||
"result": { | ||
"engine": "knitr", | ||
"markdown": "---\ntitle: \"Exploring the Wide World of ggplot2 Extensions\"\nauthor: \n - \"Eric R. Scott\"\n - \"Kristina Riemer\"\n - \"Renata Diaz\"\ndate: 2024-06-20\nformat: \n uaz-revealjs: default\nexecute: \n echo: true\neditor: visual\n---\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(ggplot2)\nlibrary(palmerpenguins)\n```\n:::\n\n\n## `gganimate`\n\nDisplay transitions between states of a variable\n\nUseful for showing trends in time series & spatial data\n\n::: callout-tip\n## Advice from the experts!\n\n\"Graphic elements should only transition between instances of the same underlying phenomenon\"\n:::\n\n## Example\n\nBody size distribution of penguins changing over the years\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(penguins, aes(x = body_mass_g, col = species)) +\n geom_density() +\n facet_wrap(~year)\n```\n\n::: {.cell-output-display}\n![](slides-gganimate_files/figure-revealjs/unnamed-chunk-2-1.png){width=960}\n:::\n:::\n\n\n## Show annual transition\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gganimate)\n\nggplot(penguins, aes(x = body_mass_g, col = species)) +\n geom_density() +\n transition_states(year) +\n ggtitle('Year: {closest_state}')\n```\n\n::: {.cell-output-display}\n![](slides-gganimate_files/figure-revealjs/unnamed-chunk-3-1.gif)\n:::\n:::\n\n\n## Add more detail\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(penguins, aes(x = body_mass_g, col = species)) +\n geom_density() +\n transition_states(year) +\n ggtitle('Year: {closest_state}') +\n shadow_wake(wake = 0.25)\n```\n\n::: {.cell-output-display}\n![](slides-gganimate_files/figure-revealjs/unnamed-chunk-4-1.gif)\n:::\n:::\n\n\n## Save file\n\n\n::: {.cell}\n\n```{.r .cell-code}\nanim_save(\"~/Desktop/test_anim.gif\")\n```\n:::\n\n\n## Resources\n\n- Cheat sheet: <https://rstudio.github.io/cheatsheets/gganimate.pdf>\n- Website: <https://gganimate.com>\n", | ||
"supporting": [ | ||
"slides-gganimate_files" | ||
], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": { | ||
"include-after-body": [ | ||
"\n<script>\n // htmlwidgets need to know to resize themselves when slides are shown/hidden.\n // Fire the \"slideenter\" event (handled by htmlwidgets.js) when the current\n // slide changes (different for each slide format).\n (function () {\n // dispatch for htmlwidgets\n function fireSlideEnter() {\n const event = window.document.createEvent(\"Event\");\n event.initEvent(\"slideenter\", true, true);\n window.document.dispatchEvent(event);\n }\n\n function fireSlideChanged(previousSlide, currentSlide) {\n fireSlideEnter();\n\n // dispatch for shiny\n if (window.jQuery) {\n if (previousSlide) {\n window.jQuery(previousSlide).trigger(\"hidden\");\n }\n if (currentSlide) {\n window.jQuery(currentSlide).trigger(\"shown\");\n }\n }\n }\n\n // hookup for slidy\n if (window.w3c_slidy) {\n window.w3c_slidy.add_observer(function (slide_num) {\n // slide_num starts at position 1\n fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);\n });\n }\n\n })();\n</script>\n\n" | ||
] | ||
}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
Binary file added
BIN
+194 KB
_freeze/2024/03-extensions/slides-gganimate/figure-revealjs/unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.23 MB
_freeze/2024/03-extensions/slides-gganimate/figure-revealjs/unnamed-chunk-3-1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.44 MB
_freeze/2024/03-extensions/slides-gganimate/figure-revealjs/unnamed-chunk-4-1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.