Skip to content
R for the Rest of Us Logo

This lesson is locked

Get access to all lessons in this course.

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Complete the color and fill sections of the data-visualization-exercises.Rmd file.

Learn More

color and fill Resources

You may want to review Chapter 3 from R for Data Science , which includes a section on mapping data to color and fill aesthetics. Chapter 2 of Fundamentals of Data Visualization has a similar discussion. So does Chapter 3 of Data Visualization: A Practical Introduction.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Atlang Mompe

Atlang Mompe

April 4, 2021

Hi David, when you do the coord_flip() - can you order the data into ascending or descending by the variable? If so, could you kindly show us how to do so? So for the age_decade by height - what if I wanted to see the tallest age_decade to the shortest age_decade, what would the code look lik?

Thank you, Atty

David Keyes

David Keyes

April 5, 2021

The easiest way for me to explain this is to point you to this lesson from the Going Deeper course. Long story short: you need to use factors in order to determine order of plots. It's slightly confusing because you use arrange() for tables, but that doesn't work to order plots. Here's an explanation video.

Kateryn Pino

Kateryn Pino

April 7, 2021

Hi David, In this exercise, Can I drop NAs in the same ggplot code, or I necessarily have to do some data wrangling first? Thanks!

David Keyes

David Keyes

April 8, 2021

You could either remove them by doing some wrangling before plotting or you could use the na.value argument in several scale functions (e.g. <a href="https://ggplot2.tidyverse.org/reference/scale_brewer.html" rel="nofollow ugc">scale_brewer()</a>).

At this point in the exercise file, my code stopped automatically indenting and the function help tooltips stopped appearing. The commented lines in the code chunk also appear in blue instead of green here. I'm not sure what I did to cause this, and I got the code to work by indenting myself, but it takes a lot longer when it's not running automatically. Did I mess something up that I can change back easily?

David Keyes

David Keyes

October 6, 2021

Can you please post your code as a Gist and share the link?

https://gist.github.com/ensykes/94f95665a0f2c52048cc08faa7619ae4

David Keyes

David Keyes

October 6, 2021

I see the issue! Look right above the # color and fill first-level header. You have an extra triple backtick. That's making things stop working. Delete that and you should be good to go.

Thank you!!