Skip to content

Commit

Permalink
fix chunk options
Browse files Browse the repository at this point in the history
  • Loading branch information
clauswilke committed Aug 9, 2024
1 parent 1535dd6 commit 87fee98
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 53 deletions.
14 changes: 7 additions & 7 deletions docs/materials/positconf2024-colors.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editor: visual
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand All @@ -27,8 +27,8 @@ install.packages(
We will create a simple scatter plot using the default ggplot hue scale, test for suitability for people with color-vision deficiency (CVD), and then create our own color palette as a replacement.

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(palmerpenguins) # for `penguins` data
Expand All @@ -46,7 +46,7 @@ p
Now check the plot in the CVD simulator. You need to save it as an image file first.

```{r}
#| eval = FALSE
#| eval: FALSE
# save the plot as png file
ggsave("penguins.png", p, width = 6, height = 4)
Expand All @@ -58,7 +58,7 @@ colorspace::cvd_emulator()
Now create your own categorical color palette using the color chooser app from the colorspace package.

```{r}
#| eval = FALSE
#| eval: FALSE
# run interactively to choose colors
colorspace::choose_color()
Expand All @@ -85,7 +85,7 @@ colorspace::cvd_emulator()
Now we will create a sequential color palette. We will use the following plot, which shows mean temperatures in four locales in the US.

```{r}
#| message = FALSE
#| message: FALSE
# load and prepare data
temps_months <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/tempnormals.csv") %>%
Expand Down Expand Up @@ -117,7 +117,7 @@ ggplot(temps_months, aes(x = month, y = location, fill = mean)) +
Now create your own sequential color palette using the color chooser app from the colorspace package.

```{r}
#| eval = FALSE
#| eval: FALSE
# run interactively to choose colors
colorspace::choose_color()
Expand Down
8 changes: 4 additions & 4 deletions docs/materials/positconf2024-legends-solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ editor: visual
## Load required packages

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(colorspace)
Expand All @@ -21,7 +21,7 @@ library(cowplot)
**Exercise 1.1:** Replace the legend in this plot with a secondary axis. Also style the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down Expand Up @@ -137,7 +137,7 @@ p + theme(legend.position = "top")
**Exercise 2.1:** Take the preprint plot from a prior exercise and move the legend inside the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down
10 changes: 5 additions & 5 deletions docs/materials/positconf2024-legends.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editor: visual
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand All @@ -27,8 +27,8 @@ install.packages(
By default, ggplot places legend entries in alphabetical order, and that is rarely what we want. See this example:

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(colorspace)
Expand Down Expand Up @@ -161,7 +161,7 @@ ggplot(iris) +
**Exercise 1.1:** Replace the legend in this plot with a secondary axis. Also style the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down Expand Up @@ -249,7 +249,7 @@ ggplot(mtcars) +
**Exercise 2.1:** Take the preprint plot from a prior exercise and move the legend inside the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down
6 changes: 3 additions & 3 deletions docs/materials/positconf2024-pattern-fill-solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ knitr:
## Load required packages

```{r}
#| message = FALSE
#| message: FALSE
library(tidyverse)
library(grid)
Expand Down Expand Up @@ -151,7 +151,7 @@ penguins |>
Data preparation:

```{r}
#| message = FALSE
#| message: FALSE
# data taken from: https://github.com/john-guerra/US_Elections_Results/tree/master
votes_2016 <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/2016_US_County_Level_Presidential_Results.csv") |>
Expand Down Expand Up @@ -326,7 +326,7 @@ pet_ownership |>
2. Recreate the pet ownership isotype plot with ggpattern.

```{r}
#| warning = FALSE
#| warning: FALSE
library(ggpattern)
pet_images <- c(
Expand Down
6 changes: 3 additions & 3 deletions docs/materials/positconf2024-pattern-fill.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ knitr:
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand All @@ -40,7 +40,7 @@ With the release of ggplot 3.5.0, we now have the ability to fill areas with gra
Let's start with some basic gradient and pattern fills. First we load the required packages.

```{r}
#| message = FALSE
#| message: FALSE
library(tidyverse)
library(grid) # for pattern creation
Expand Down Expand Up @@ -184,7 +184,7 @@ We see that the patterns are also applied to the legend. I would not normally wa
We'll be visualizing state-level election results from the 2016 US presidential election. Let's begin with loading the required packages and main data. The data table provides us with the election results for the democratic, republican, and other candidates for each county in the US. Counties are identified by their fips codes.

```{r}
#| message = FALSE
#| message: FALSE
library(sf) # for manipulating geospatial data
Expand Down
2 changes: 1 addition & 1 deletion docs/materials/positconf2024-themes-solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Add appropriate themes and axis expansions to the following plots.
**Exercise 1.1:**

```{r}
#| message = FALSE
#| message: FALSE
library(tidyverse)
library(cowplot)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/materials/positconf2024-themes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editor: visual
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand Down Expand Up @@ -38,7 +38,7 @@ You don't have to agree with my design choices or use my themes, but I hope that
Let's make a simple plot and apply the various theme functions.

```{r}
#| message = FALSE
#| message: FALSE
library(tidyverse)
library(palmerpenguins) # for `penguins` dataset
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"description": "A bootcamp-style course on data visualization",
"author": [],
"contents": "\nThis is the home page for a dataviz shortcourse by Claus O. Wilke. The course is an abbreviated version of a semester-long course taught at The University of Texas at Austin. Many of the materials presented are taken from the book Fundamentals of Data Visualization.\n\nReuse\nText and figures are licensed under Creative Commons Attribution CC BY 4.0. Any computer code (R, HTML, CSS, etc.) in slides and worksheets, including in slide and worksheet sources, is also licensed under MIT. Note that figures in slides may be pulled in from external sources and may be licensed under different terms. For such images, image credits are available in the slide notes, accessible via pressing the letter ‘p’.\n\n\n\n",
"last_modified": "2024-08-08T16:54:16-05:00"
"last_modified": "2024-08-08T21:27:03-05:00"
},
{
"path": "lessons.html",
"title": "Lessons",
"description": "",
"author": [],
"contents": "\n\nContents\nEffective Visual Communication\nFrom Data to Visualisation 1\nFrom Data to Visualisation 2\nPrinciples of Figure Design\nReuse\n\nEffective Visual Communication\nThis lecture covers three core concepts of visual communication. First, I will discuss how to engage your audience by telling a story. Second, I will provide high-level guidance for designing visualizations that make a clear point. Third, I will describe key design principles that ensure your figures will be readable by people with vision impairments, and specifically impairments of color perception.\n\nMaterials:\n\nSlides\nFrom Data to Visualisation 1\nVisualizing amounts; visualizing distributions; visualizing associations and trends\n\nMaterials:\n\nSlides\nFrom Data to Visualisation 2\nVisualizing uncertainty; visualizing geospatial data\n\nMaterials:\n\nSlides\nPrinciples of Figure Design\nColors; compound figures; infographics\n\nMaterials:\n\nSlides\nReuse\nText and figures are licensed under Creative Commons Attribution CC BY 4.0. Any computer code (R, HTML, CSS, etc.) in slides and worksheets, including in slide and worksheet sources, is also licensed under MIT. Note that figures in slides may be pulled in from external sources and may be licensed under different terms. For such images, image credits are available in the slide notes, accessible via pressing the letter ‘p’.\n\n\n\n",
"last_modified": "2024-08-08T16:54:17-05:00"
"last_modified": "2024-08-08T21:27:03-05:00"
},
{
"path": "workshops.html",
"title": "Workshops",
"description": "",
"author": [],
"contents": "\n\nContents\nReuse\n\nMaterials for past and present workshops. Many workshop materials are based on content from my semester-long data visualization course at UT Austin.\n2024-08-12: Effective Data Visualization with ggplot2\nAll workshop materials will be posted here.\n2024-06-24: Visualizing Uncertainty and Trends\nKeynote, June 24 2024: slides\nWorkshop, June 27 2024:\nQuarto notebook\nHTML\nHTML with solutions\n\n2024-06-20: Effective Visual Communication with R\nWorkshop in support of Ukraine. To work through all the examples provided, you will need the following R packages: tidyverse, cowplot, ggiraph, sf, patchwork\nSlides Part 1\nSlides Part 2\nSlides Part 2, without interactivity (Some browsers crash when there are too many interactive examples in one slide set.)\n2024-05-28: Effective Visual Communication\nSlides Part 1 (telling a story, making a point, making figures accessible)\nSlides Part 2 (figure composition and context, text annotations, overplotting)\nReuse\nText and figures are licensed under Creative Commons Attribution CC BY 4.0. Any computer code (R, HTML, CSS, etc.) in slides and worksheets, including in slide and worksheet sources, is also licensed under MIT. Note that figures in slides may be pulled in from external sources and may be licensed under different terms.\n\n\n\n",
"last_modified": "2024-08-08T16:54:17-05:00"
"last_modified": "2024-08-08T21:27:04-05:00"
}
],
"collections": []
Expand Down
14 changes: 7 additions & 7 deletions materials/positconf2024-colors.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editor: visual
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand All @@ -27,8 +27,8 @@ install.packages(
We will create a simple scatter plot using the default ggplot hue scale, test for suitability for people with color-vision deficiency (CVD), and then create our own color palette as a replacement.

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(palmerpenguins) # for `penguins` data
Expand All @@ -46,7 +46,7 @@ p
Now check the plot in the CVD simulator. You need to save it as an image file first.

```{r}
#| eval = FALSE
#| eval: FALSE
# save the plot as png file
ggsave("penguins.png", p, width = 6, height = 4)
Expand All @@ -58,7 +58,7 @@ colorspace::cvd_emulator()
Now create your own categorical color palette using the color chooser app from the colorspace package.

```{r}
#| eval = FALSE
#| eval: FALSE
# run interactively to choose colors
colorspace::choose_color()
Expand All @@ -85,7 +85,7 @@ colorspace::cvd_emulator()
Now we will create a sequential color palette. We will use the following plot, which shows mean temperatures in four locales in the US.

```{r}
#| message = FALSE
#| message: FALSE
# load and prepare data
temps_months <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/tempnormals.csv") %>%
Expand Down Expand Up @@ -117,7 +117,7 @@ ggplot(temps_months, aes(x = month, y = location, fill = mean)) +
Now create your own sequential color palette using the color chooser app from the colorspace package.

```{r}
#| eval = FALSE
#| eval: FALSE
# run interactively to choose colors
colorspace::choose_color()
Expand Down
8 changes: 4 additions & 4 deletions materials/positconf2024-legends-solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ editor: visual
## Load required packages

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(colorspace)
Expand All @@ -21,7 +21,7 @@ library(cowplot)
**Exercise 1.1:** Replace the legend in this plot with a secondary axis. Also style the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down Expand Up @@ -137,7 +137,7 @@ p + theme(legend.position = "top")
**Exercise 2.1:** Take the preprint plot from a prior exercise and move the legend inside the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down
10 changes: 5 additions & 5 deletions materials/positconf2024-legends.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editor: visual
Install the required packages:

```{r}
#| eval = FALSE
#| eval: FALSE
# Run this command to install the required packages.
# You need to do this only once.
Expand All @@ -27,8 +27,8 @@ install.packages(
By default, ggplot places legend entries in alphabetical order, and that is rarely what we want. See this example:

```{r}
#| message = FALSE,
#| warning = FALSE
#| message: FALSE
#| warning: FALSE
library(tidyverse)
library(colorspace)
Expand Down Expand Up @@ -161,7 +161,7 @@ ggplot(iris) +
**Exercise 1.1:** Replace the legend in this plot with a secondary axis. Also style the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down Expand Up @@ -249,7 +249,7 @@ ggplot(mtcars) +
**Exercise 2.1:** Take the preprint plot from a prior exercise and move the legend inside the plot.

```{r}
#| message = FALSE
#| message: FALSE
preprints <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/preprints.csv") |>
filter(archive %in% c("bioRxiv", "arXiv q-bio")) |>
Expand Down
6 changes: 3 additions & 3 deletions materials/positconf2024-pattern-fill-solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ knitr:
## Load required packages

```{r}
#| message = FALSE
#| message: FALSE
library(tidyverse)
library(grid)
Expand Down Expand Up @@ -151,7 +151,7 @@ penguins |>
Data preparation:

```{r}
#| message = FALSE
#| message: FALSE
# data taken from: https://github.com/john-guerra/US_Elections_Results/tree/master
votes_2016 <- read_csv("https://wilkelab.org/dataviz_shortcourse/datasets/2016_US_County_Level_Presidential_Results.csv") |>
Expand Down Expand Up @@ -326,7 +326,7 @@ pet_ownership |>
2. Recreate the pet ownership isotype plot with ggpattern.

```{r}
#| warning = FALSE
#| warning: FALSE
library(ggpattern)
pet_images <- c(
Expand Down
Loading

0 comments on commit 87fee98

Please sign in to comment.