diff --git a/modules/Esquisse_Data_Visualization/Esquisse_Data_Visualization.Rmd b/modules/Esquisse_Data_Visualization/Esquisse_Data_Visualization.Rmd index 8c6841e9..cb1bc273 100644 --- a/modules/Esquisse_Data_Visualization/Esquisse_Data_Visualization.Rmd +++ b/modules/Esquisse_Data_Visualization/Esquisse_Data_Visualization.Rmd @@ -10,6 +10,7 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(here) +library(tidyverse) ``` ## Esquisse Package @@ -30,12 +31,23 @@ It's super **nifty**! knitr::include_graphics("https://c.tenor.com/DNUSO9MjrTEAAAAC/bob-ross.gif") ``` +## First, get some data.. + +We can use the CO heat-related ER visits dataset. This dataset contains information about the number and rate of visits for heat-related illness to ERs in Colorado from 2011-2022, adjusted for age. + +```{r message=FALSE} +er <- + read_csv("https://daseh.org/data/CO_ER_heat_visits.csv") + +head(er) +``` + ## Starting a plot Using the `esquisser()` function you can start creating a plot for a `data.frame` or `tibble`. That's it! ```{r, eval = FALSE} -esquisser(mtcars) +esquisser(er) ``` ```{r, fig.alt="starting a plot", out.width = "90%", echo = FALSE, fig.align='center'} @@ -45,14 +57,14 @@ knitr::include_graphics("images/start_a_plot.png") ## Show the plot in the browser ```{r, eval = FALSE} -esquisse::esquisser(iris, viewer = "browser") +esquisse::esquisser(er, viewer = "browser") ``` ## Select Variables To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on. -```{r, fig.alt="select variables", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="select variables", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/variables.gif") ``` @@ -60,7 +72,7 @@ knitr::include_graphics("images/variables.gif") To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on. -```{r, fig.alt="select variables", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="select variables", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/get_code.gif") ``` @@ -68,7 +80,7 @@ knitr::include_graphics("images/get_code.gif") `esquisse` automatically assumes a plot type, but you might want to change this. -```{r, fig.alt="change plot type", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="change plot type", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/change_type_short.gif") ``` @@ -76,7 +88,7 @@ knitr::include_graphics("images/change_type_short.gif") Facets create multiple plots based on the different values of a variable. -```{r, fig.alt="add facets", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="add facets", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/facet.gif") ``` @@ -84,7 +96,7 @@ knitr::include_graphics("images/facet.gif") Sometimes it is useful to change the way points are plotted so that size represents a variable. This can especially be helpful if you need your plot to be black and white. -```{r, fig.alt="add color", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="add color", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/size.gif") ``` @@ -93,32 +105,24 @@ knitr::include_graphics("images/size.gif") For plots with points use the color region to change coloring according to a variable. (use "fill" for bar plots) -```{r, fig.alt="add color", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="add color", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/color.gif") ``` ## Appearance -You can change the overall appearance with the appearance tab. +You can change the overall appearance with "Geometries" and "Theme". -```{r, fig.alt="change overall appearance", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="change overall appearance", out.width = "70%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/appearance.gif") ``` -## Smooth Lines - -Especially when you have a scatter plot, it can be helpful to add a smooth/trend line. - -```{r, fig.alt="add smooth line", out.width = "100%", echo = FALSE, fig.align='center'} -knitr::include_graphics("images/smooth.gif") -``` - ## Change titles -To change titles on your plot, use the titles tab. +To change titles on your plot, use the "Labels & Titles" tab. -```{r, fig.alt="change titles", out.width = "100%", echo = FALSE, fig.align='center'} -knitr::include_graphics("images/titles.gif") +```{r, fig.alt="change titles", out.width = "70%", echo = FALSE, fig.align='center'} +knitr::include_graphics("images/title.gif") ``` ## View data @@ -137,19 +141,21 @@ Use the stop button or press ctrl+c to stop the Esquisse app. _If you don't see the stop button, you need to resize your window._ -```{r, fig.alt="Click the stop button to interrupt the Esquisse app.", out.width = "100%", echo = FALSE, fig.align='center'} +```{r, fig.alt="Click the stop button to interrupt the Esquisse app.", out.width = "50%", echo = FALSE, fig.align='center'} knitr::include_graphics("images/stop.png") ``` -## Wide & Long Data Example +## Wide & Long Data ? {.codesmall} -Let's look at the CO heat-related ER visits dataset again. This time we want to look at only Boulder and Denver counties, and only the visit and year data. +Let's look at why we might want long data using Esquisse. ```{r message=FALSE} -library(dplyr) +library(tidyverse) er <- read_csv(file = "https://daseh.org/data/CO_ER_heat_visits.csv") -long_er <- er %>% filter(county == c("Denver", "Boulder")) %>% select(c("county", "year", "visits")) +long_er <- er %>% + filter(county == c("Denver", "Boulder")) %>% + select(c("county", "year", "visits")) glimpse(long_er) ``` @@ -177,6 +183,16 @@ esquisser(wide_er) # county as x...? Tricky! esquisser(long_er) #county as x, visit rate as y, year as fill ``` +## GUT CHECK! + +Why use Esquisse? + +A. Explore your data + +B. Get a "head start" on your code + +C. Both of these! + ## Some Alternatives to `esquisse` * `ggquickeda`: https://smouksassi.github.io/ggquickeda/ diff --git a/modules/Esquisse_Data_Visualization/images/appearance.gif b/modules/Esquisse_Data_Visualization/images/appearance.gif index 25de4642..e065a846 100644 Binary files a/modules/Esquisse_Data_Visualization/images/appearance.gif and b/modules/Esquisse_Data_Visualization/images/appearance.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/change_type_short.gif b/modules/Esquisse_Data_Visualization/images/change_type_short.gif index 4abf2846..d892418d 100644 Binary files a/modules/Esquisse_Data_Visualization/images/change_type_short.gif and b/modules/Esquisse_Data_Visualization/images/change_type_short.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/color.gif b/modules/Esquisse_Data_Visualization/images/color.gif index c78cc6e5..7067ba76 100644 Binary files a/modules/Esquisse_Data_Visualization/images/color.gif and b/modules/Esquisse_Data_Visualization/images/color.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/facet.gif b/modules/Esquisse_Data_Visualization/images/facet.gif index ea509c97..b1c3059c 100644 Binary files a/modules/Esquisse_Data_Visualization/images/facet.gif and b/modules/Esquisse_Data_Visualization/images/facet.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/get_code.gif b/modules/Esquisse_Data_Visualization/images/get_code.gif index 310012d3..02f722b0 100644 Binary files a/modules/Esquisse_Data_Visualization/images/get_code.gif and b/modules/Esquisse_Data_Visualization/images/get_code.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/size.gif b/modules/Esquisse_Data_Visualization/images/size.gif index cbb8b81c..5d55704e 100644 Binary files a/modules/Esquisse_Data_Visualization/images/size.gif and b/modules/Esquisse_Data_Visualization/images/size.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/start_a_plot.png b/modules/Esquisse_Data_Visualization/images/start_a_plot.png index 3f21062f..3c428260 100644 Binary files a/modules/Esquisse_Data_Visualization/images/start_a_plot.png and b/modules/Esquisse_Data_Visualization/images/start_a_plot.png differ diff --git a/modules/Esquisse_Data_Visualization/images/stop.png b/modules/Esquisse_Data_Visualization/images/stop.png index 9cdfed95..c0c64cfd 100644 Binary files a/modules/Esquisse_Data_Visualization/images/stop.png and b/modules/Esquisse_Data_Visualization/images/stop.png differ diff --git a/modules/Esquisse_Data_Visualization/images/title.gif b/modules/Esquisse_Data_Visualization/images/title.gif new file mode 100644 index 00000000..da1cf29e Binary files /dev/null and b/modules/Esquisse_Data_Visualization/images/title.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/titles.gif b/modules/Esquisse_Data_Visualization/images/titles.gif deleted file mode 100644 index ab660306..00000000 Binary files a/modules/Esquisse_Data_Visualization/images/titles.gif and /dev/null differ diff --git a/modules/Esquisse_Data_Visualization/images/variables.gif b/modules/Esquisse_Data_Visualization/images/variables.gif index 4180924c..63bdd297 100644 Binary files a/modules/Esquisse_Data_Visualization/images/variables.gif and b/modules/Esquisse_Data_Visualization/images/variables.gif differ diff --git a/modules/Esquisse_Data_Visualization/images/view_data.png b/modules/Esquisse_Data_Visualization/images/view_data.png index 462c551b..3627c784 100644 Binary files a/modules/Esquisse_Data_Visualization/images/view_data.png and b/modules/Esquisse_Data_Visualization/images/view_data.png differ