Skip to content

Commit

Permalink
next slideset ready
Browse files Browse the repository at this point in the history
  • Loading branch information
clauswilke committed Dec 24, 2024
1 parent 28ab0a1 commit 87111d5
Show file tree
Hide file tree
Showing 22 changed files with 3,012 additions and 25,649 deletions.
3 changes: 3 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project:
render:
- "*.qmd"
- "!slides/"
- "!worksheets/"

website:
title: "SDS 366"
Expand All @@ -20,6 +21,8 @@ website:
menu:
- text: "Class 2: Aesthetic mappings"
href: slides/aesthetic-mappings.qmd
- text: "Class 3: Telling a story"
href: slides/telling-a-story.qmd

- text: "Worksheets"
menu:
Expand Down
6 changes: 5 additions & 1 deletion _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@
<li>
<a class="dropdown-item" href="./slides/aesthetic-mappings.qmd">
<span class="dropdown-text">Class 2: Aesthetic mappings</span></a>
</li>
<li>
<a class="dropdown-item" href="./slides/telling-a-story.qmd">
<span class="dropdown-text">Class 3: Telling a story</span></a>
</li>
</ul>
</li>
Expand All @@ -154,7 +158,7 @@
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="nav-menu-worksheets">
<li>
<a class="dropdown-item" href="./worksheets/aesthetic-mappings.html">
<a class="dropdown-item" href="./worksheets/aesthetic-mappings.qmd">
<span class="dropdown-text">Class 2: Aesthetic mappings</span></a>
</li>
</ul>
Expand Down
6 changes: 5 additions & 1 deletion _site/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
<li>
<a class="dropdown-item" href="./slides/aesthetic-mappings.qmd">
<span class="dropdown-text">Class 2: Aesthetic mappings</span></a>
</li>
<li>
<a class="dropdown-item" href="./slides/telling-a-story.qmd">
<span class="dropdown-text">Class 3: Telling a story</span></a>
</li>
</ul>
</li>
Expand All @@ -119,7 +123,7 @@
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="nav-menu-worksheets">
<li>
<a class="dropdown-item" href="./worksheets/aesthetic-mappings.html">
<a class="dropdown-item" href="./worksheets/aesthetic-mappings.qmd">
<span class="dropdown-text">Class 2: Aesthetic mappings</span></a>
</li>
</ul>
Expand Down
105 changes: 28 additions & 77 deletions _site/search.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,4 @@
[
{
"objectID": "worksheets/aesthetic-mappings.html",
"href": "worksheets/aesthetic-mappings.html",
"title": "Aesthetic mappings",
"section": "",
"text": "In this worksheet, we will discuss a core concept of ggplot, the mapping of data values onto aesthetics.\nFirst we need to load the required R packages and the data. Please run this code to ensure the subsequent exercises work.\n\n\n\n\n\n\n\n\nWe will first work with the dataset temps_houston which contains the average temperature for each day of the year for Houston, TX."
},
{
"objectID": "worksheets/aesthetic-mappings.html#introduction",
"href": "worksheets/aesthetic-mappings.html#introduction",
"title": "Aesthetic mappings",
"section": "",
"text": "In this worksheet, we will discuss a core concept of ggplot, the mapping of data values onto aesthetics.\nFirst we need to load the required R packages and the data. Please run this code to ensure the subsequent exercises work.\n\n\n\n\n\n\n\n\nWe will first work with the dataset temps_houston which contains the average temperature for each day of the year for Houston, TX."
},
{
"objectID": "worksheets/aesthetic-mappings.html#basic-use-of-ggplot",
"href": "worksheets/aesthetic-mappings.html#basic-use-of-ggplot",
"title": "Aesthetic mappings",
"section": "Basic use of ggplot",
"text": "Basic use of ggplot\nIn the most basic use of ggplot, we call the ggplot() function with a dataset and an aesthetic mapping (created with aes()), and then we add a geom, such as geom_line() to draw lines or geom_point() to draw points.\nTry this for yourself. Map the column day_of_year onto the x axis and the column temperature onto the y axis, and use geom_line() to display the data.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temps_houston, aes(x = day_of_year, y = temperature)) +\n geom_line()\n\n\n\n\nTry again. Now use geom_point() instead of geom_line().\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temps_houston, aes(x = day_of_year, y = temperature)) +\n geom_point()\n\n\n\n\nAnd now swap which column you map to x and which to y.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temps_houston, aes(x = temperature, y = day_of_year)) +\n geom_point()"
},
{
"objectID": "worksheets/aesthetic-mappings.html#more-complex-geoms",
"href": "worksheets/aesthetic-mappings.html#more-complex-geoms",
"title": "Aesthetic mappings",
"section": "More complex geoms",
"text": "More complex geoms\nYou can use other geoms to make different types of plots. For example, geom_boxplot() will make boxplots. For boxplots, we frequently want categorical data on the x or y axis. For example, we might want a separate boxplot for each month. Try this out. Puth month on the x axis, temperature on the y axis, and use geom_boxplot().\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temps_houston, aes(x = month, y = temperature)) +\n ___()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temps_houston, aes(x = month, y = temperature)) +\n geom_boxplot()\n\n\n\n\nNow put the month on the y axis and the temperature on the x axis.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temps_houston, aes(x = ___, y = ___)) +\n geom_boxplot()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temps_houston, aes(x = temperature, y = month)) +\n geom_boxplot()"
},
{
"objectID": "worksheets/aesthetic-mappings.html#adding-color",
"href": "worksheets/aesthetic-mappings.html#adding-color",
"title": "Aesthetic mappings",
"section": "Adding color",
"text": "Adding color\nNext we will be working with the dataset temperatures, which is similar to temps_houston but contains data for three more locations:\n\n\n\n\n\n\n\n\nMake a line plot of temperature against day_of_year, using the color aesthetic to color the lines by location.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = day_of_year, y = temperature, color = ___)) +\n geom_line()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = day_of_year, y = temperature, color = location)) +\n geom_line()\n\n\n\n\nTry again, this time using location as the location along the y axis and temperature for the color. This plot looks better with geom_point() than geom_line(). (Try it out to see why. Also, try geom_point(size = 5) to create larger points.)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = ___, y = ___, color = ___)) +\n geom_point()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = day_of_year, y = location, color = temperature)) +\n geom_point()"
},
{
"objectID": "worksheets/aesthetic-mappings.html#using-the-fill-aesthetic",
"href": "worksheets/aesthetic-mappings.html#using-the-fill-aesthetic",
"title": "Aesthetic mappings",
"section": "Using the fill aesthetic",
"text": "Using the fill aesthetic\nSome geoms use a fill aesthetic, which is similar to color but applies to shaded areas. (color applies to lines and points.) For example, we can use the fill aesthetic with geom_boxplot() to color the interior of the box. Try this yourself. Plot month on x, temperature on y, and color the interior of the box by location.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = ___, fill = ___)) +\n geom_boxplot()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, fill = location)) +\n geom_boxplot()\n\n\n\n\nCan you color the lines of the boxplot by location and the interior by month? Try it.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, color = ___, fill = ___)) +\n geom_boxplot()\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, color = location, fill = month)) +\n geom_boxplot()"
},
{
"objectID": "worksheets/aesthetic-mappings.html#using-aesthetics-as-parameters",
"href": "worksheets/aesthetic-mappings.html#using-aesthetics-as-parameters",
"title": "Aesthetic mappings",
"section": "Using aesthetics as parameters",
"text": "Using aesthetics as parameters\nMany of the aesthetics (such as color, fill, and also size to change line size or point thickness) can be used as parameters inside a geom rather than inside an aes() statement. The difference is that when you use an aesthetic as a parameter, you specify a specific value, such as color = \"blue\", rather than a mapping, such as aes(color = location). Notice the difference: Inside the aes() function, we don’t actually specify the specific color values, ggplot does that for us. We only say that we want the data values of the location column to correspond to different colors. (We will learn later how to tell ggplot to use specific colors in this mapping.)\nTry this with the boxplot example from the previous section. Map location onto the fill aesthetic but set the color of the lines to \"navyblue\".\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, fill = ___)) +\n geom_boxplot(color = ___)\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, fill = location)) +\n geom_boxplot(color = \"navyblue\")\n\n\n\n\nNow do the reverse. Map location onto the line colors but fill the box with the color \"navyblue\".\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nHint\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, color = ___)) +\n geom_boxplot(fill = ___)\n\n\n\n\n\n\n\n\n\n\n\nSolution\n\n\n\n\n\nggplot(temperatures, aes(x = month, y = temperature, color = location)) +\n geom_boxplot(fill = \"navyblue\")"
},
{
"objectID": "schedule.html#homeworks",
"href": "schedule.html#homeworks",
"title": "SDS 366 Schedule Spring 2025",
"section": "Homeworks",
"text": "Homeworks\nAll homeworks are due by 11:00pm on the day they are due. Homeworks need to be submitted as pdf files on Canvas."
},
{
"objectID": "schedule.html#projects",
"href": "schedule.html#projects",
"title": "SDS 366 Schedule Spring 2025",
"section": "Projects",
"text": "Projects\nAll projects are due by 11:00pm on the day they are due. Projects need to be submitted on Canvas. Please carefully read the submission instructions for each project."
},
{
"objectID": "index.html",
"href": "index.html",
"title": "SDS 366",
"section": "",
"text": "This is the home page for SDS 366, Data Visualization in R. All course materials will be posted on this site.\nInstructor: Claus O. Wilke\nMeeting times: TTH 5:00pm to 6:30pm Venue: MEZ B0.306 Syllabus: click here\nUpcoming lectures and assignments: click here"
},
{
"objectID": "index.html#computing-requirements",
"href": "index.html#computing-requirements",
"title": "SDS 366",
"section": "Computing requirements",
"text": "Computing requirements\nFor students enrolled in this course, you only need a working web browser to access the edupod server, located at: https://edupod.cns.utexas.edu/\nIf you are using the edupod server, stop reading here. Everything is pre-installed and no further action is needed.\nTo run any of the materials locally on your own machine, you will need the following:\n\nA recent version of R, download from here.\nA recent version of RStudio, download from here, OR a recent version of Positron, download from here.\nThe following R packages:\nbroom, cluster, colorspace, cowplot, distill, gapminder, GGally, gganimate, ggiraph, ggdendro, ggdist, ggforce, ggplot2movies, ggrepel, ggridges, ggthemes, gifski, glue, knitr, learnr, naniar, margins, MASS, Matrix, nycflights13, palmerpenguins, patchwork, rmarkdown, rnaturalearth, rnaturalearthhires, scales, sf, shinyjs, sp, tidyverse, transformr, umap, xaringan\n\nYou can install all required R packages at once by running the following code in the R command line:\n# first run this command:\ninstall.packages(\n c(\n \"broom\", \"cluster\", \"colorspace\", \"cowplot\", \"distill\", \"gapminder\", \n \"GGally\", \"gganimate\", \"ggiraph\", \"ggdendro\", \"ggdist\", \"ggforce\",\n \"ggplot2movies\", \"ggrepel\", \"ggridges\", \"ggthemes\", \"gifski\", \"glue\",\n \"knitr\", \"learnr\", \"naniar\", \"margins\", \"MASS\", \"Matrix\",\n \"nycflights13\", \"palmerpenguins\", \"patchwork\", \"rmarkdown\", \"rnaturalearth\",\n \"scales\", \"sf\", \"shinyjs\", \"sp\", \"tidyverse\", \"transformr\", \"umap\",\n \"xaringan\"\n )\n)\n\n# then run this command:\ninstall.packages(\n \"rnaturalearthhires\", repos = \"https://packages.ropensci.org\", type = \"source\"\n)"
},
{
"objectID": "syllabus.html",
"href": "syllabus.html",
Expand Down Expand Up @@ -187,5 +110,33 @@
"title": "Syllabus",
"section": "Class Recordings",
"text": "Class Recordings\nIf any class recordings are provided they are reserved only for students in this class for educational purposes and are protected under FERPA. The recordings should not be shared outside the class in any form. Violation of this restriction by a student could lead to Student Misconduct proceedings."
},
{
"objectID": "index.html",
"href": "index.html",
"title": "SDS 366",
"section": "",
"text": "This is the home page for SDS 366, Data Visualization in R. All course materials will be posted on this site.\nInstructor: Claus O. Wilke\nMeeting times: TTH 5:00pm to 6:30pm Venue: MEZ B0.306 Syllabus: click here\nUpcoming lectures and assignments: click here"
},
{
"objectID": "index.html#computing-requirements",
"href": "index.html#computing-requirements",
"title": "SDS 366",
"section": "Computing requirements",
"text": "Computing requirements\nFor students enrolled in this course, you only need a working web browser to access the edupod server, located at: https://edupod.cns.utexas.edu/\nIf you are using the edupod server, stop reading here. Everything is pre-installed and no further action is needed.\nTo run any of the materials locally on your own machine, you will need the following:\n\nA recent version of R, download from here.\nA recent version of RStudio, download from here, OR a recent version of Positron, download from here.\nThe following R packages:\nbroom, cluster, colorspace, cowplot, distill, gapminder, GGally, gganimate, ggiraph, ggdendro, ggdist, ggforce, ggplot2movies, ggrepel, ggridges, ggthemes, gifski, glue, knitr, learnr, naniar, margins, MASS, Matrix, nycflights13, palmerpenguins, patchwork, rmarkdown, rnaturalearth, rnaturalearthhires, scales, sf, shinyjs, sp, tidyverse, transformr, umap, xaringan\n\nYou can install all required R packages at once by running the following code in the R command line:\n# first run this command:\ninstall.packages(\n c(\n \"broom\", \"cluster\", \"colorspace\", \"cowplot\", \"distill\", \"gapminder\", \n \"GGally\", \"gganimate\", \"ggiraph\", \"ggdendro\", \"ggdist\", \"ggforce\",\n \"ggplot2movies\", \"ggrepel\", \"ggridges\", \"ggthemes\", \"gifski\", \"glue\",\n \"knitr\", \"learnr\", \"naniar\", \"margins\", \"MASS\", \"Matrix\",\n \"nycflights13\", \"palmerpenguins\", \"patchwork\", \"rmarkdown\", \"rnaturalearth\",\n \"scales\", \"sf\", \"shinyjs\", \"sp\", \"tidyverse\", \"transformr\", \"umap\",\n \"xaringan\"\n )\n)\n\n# then run this command:\ninstall.packages(\n \"rnaturalearthhires\", repos = \"https://packages.ropensci.org\", type = \"source\"\n)"
},
{
"objectID": "schedule.html#homeworks",
"href": "schedule.html#homeworks",
"title": "SDS 366 Schedule Spring 2025",
"section": "Homeworks",
"text": "Homeworks\nAll homeworks are due by 11:00pm on the day they are due. Homeworks need to be submitted as pdf files on Canvas."
},
{
"objectID": "schedule.html#projects",
"href": "schedule.html#projects",
"title": "SDS 366 Schedule Spring 2025",
"section": "Projects",
"text": "Projects\nAll projects are due by 11:00pm on the day they are due. Projects need to be submitted on Canvas. Please carefully read the submission instructions for each project."
}
]
4 changes: 2 additions & 2 deletions _site/site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

This file was deleted.

131 changes: 0 additions & 131 deletions _site/site_libs/quarto-contrib/live-runtime/live-runtime.js

This file was deleted.

Loading

0 comments on commit 87111d5

Please sign in to comment.