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.

Slides

Learn More

The R code used in this lesson for annotations.

Check out the documentation from the ggplot book for more tips on other types of annotations.

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

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

Yuri Zharikov

Yuri Zharikov

February 20, 2023

In this and previous examples, when x-axis is a timeline with months and years, years are labeled only once (when they change). How is this achieved? Thank you, Yuri

I don't know exactly how Will did for the excess death charts (it may have been outside of R in Figma or something similar), but I have done this in R by manually creating a vector with the values. I calculate the labels by saying: "if the month is January, show {month}\n{year}" but if it is any other month just show {month}." Does that make sense?