Get access to all lessons in this course.
- Welcome to Fundamentals of R
- Update Everything
- Start a New Project
-
Data Wrangling and Analysis
- The Tidyverse
- Pipes
- select()
- mutate()
- filter()
- summarize()
- group_by() and summarize()
- arrange()
- Create a New Data Frame
- Bring it All Together (Data Wrangling)
-
Data Visualization
- The Grammar of Graphics
- Scatterplots
- Histograms
- Bar Charts
- Setting color and fill Aesthetic Properties
- Setting color and fill Scales
- Setting x and y Scales
- Adding Text to Plots
- Plot Labels
- Themes
- Facets
- Save Plots
- Bring it All Together (Data Visualization)
-
Quarto
- Quarto Overview
- YAML
- Text
- Code Chunks
- Tips for Working with Quarto
- Bring It All Together (Quarto)
-
Wrapping Up
- An Important Workflow Tip
Fundamentals of R
Plot Labels
This lesson is locked
This lesson is called Plot Labels, part of the Fundamentals of R course. This lesson is called Plot Labels, part of the Fundamentals of R course.
If the video is not playing correctly, you can watch it in a new window
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 plot labels sections of the data-visualization-exercises.Rmd file.
Learn More
Plot Labels Resources
Chapter 22 of Fundamentals of Data Visualization
Information about using position = "dodge" can be found on the tidyverse website. To see all position adjustments, check out the ggplot2 reference page.
You need to be signed-in to comment on this post. Login.
Jodi Fender
April 14, 2021
I need to do some more googling, but am trying to figure out how to have labels center on the bars - like in your example here with 3 variables (age, height, gender). I have 2 variables each with two categories and a continuous "Score" but the score for both levels is showing up in the center of the two bars rather than on the center of EACH bar. Maybe this is hard to explain here. If I don't have time to figure it out AND my question isn't clear for you to answer here, I'll submit my with the weird bar labels for feedback. Second, when I try to apply the scale_y_continuous by bars keep disappearing. I can get it to work sometimes but then suddenly it stops plotting. I guess I'll post that on my GitHub submission too. Oh! Maybe when I get to facets, I can have small multiples and bypass the issue of the centered labels...haha. But I do want to figure it out for the future.
Jodi Fender
April 14, 2021
I got somewhere with the geom_text position related to the dodging! Learning how/what to google is exciting: geom_text(aes(label = mean_standard_score), position = position_dodge(width = 1), hjust = 1.5, color = "white")