Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day2: ggplot2 #3

Open
snystrom opened this issue Jun 6, 2019 · 1 comment
Open

Day2: ggplot2 #3

snystrom opened this issue Jun 6, 2019 · 1 comment
Labels
Debrief Notes taken immediately after a class session, what worked, what didn't, how the day went.

Comments

@snystrom
Copy link
Member

snystrom commented Jun 6, 2019

Today we covered most of the material from lesson 2 leaving out most of the examples of how to customize ggplots.

We did exercises 1 through 3 in some capacity. We talked about factors a bit following the planned lesson, but we wound up using an example from the ggplot2 documentation do demonstrate how factors vs continuous variables work.

This happened because it was causing students issues when coloring data because there's an example in the ggplot2 reference manual that coerces a continuous variable to a factor

ggplot(mtcars, aes(wt, mpg)) +
  geom_point(aes(color = factor(cyl))

I had students replicate the plot without the factor call to see that ggplot by default makes it a color gradient. This is because the data type is a numeric not a factor.

I then used the factor(c("one", "two", "two", "three")) example to illustrate how factors have levels and their default assignment is alphanumeric ordering.

I ended the class by showing them how to make facets and how to use the labs function to rename axis labels and legend titles and showed them ggtitle to give a title to the plot. Finally, I told them about the theme() function and how it can be used to customize a lot of things, but I didn't give examples and instead pointed them to the ggplot2 reference page.

I told them to try to work on the final exercise outside of class and we will pick up & review it at the beginning of next weeks lesson.

@snystrom
Copy link
Member Author

snystrom commented Jun 6, 2019

We also spent time going over different mistakes & errors people made during the process of working exercises 1 - 3.

@snystrom snystrom added the Debrief Notes taken immediately after a class session, what worked, what didn't, how the day went. label Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debrief Notes taken immediately after a class session, what worked, what didn't, how the day went.
Projects
None yet
Development

No branches or pull requests

1 participant