Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Visualize your data - line chart
Work with your chart
13. Add annotation
Check yourself

Instruction

Add annotations to help readers focus on your story.

Not everyone who looks at an un-annotated chart will see the same story. You can help your readers focus on the important part of the story by adding annotations.

We noticed at the beginning that Zimbabwe's alcohol consumption is still increasing. Readers may not see this at first, so let's add a notation about it. We will use the same syntax as in the previous exercise, but with different values:

geom_text(aes(label="text", x=position_x, y= position_y), size=3, color="grey")

Notice the new argument, size. It determines the size of the text.

Exercise

Add an annotation with label:"recent upward trend\nin consumption", on the position where year = 2010 and consumption = 7. (Note: The \n forces a line break.) Use the geom_text command we've already described.

Stuck? Here's a hint!

You should write:

geom_text(aes(label = "recent upward trend\nin consumption", 
    x = parse_date_time(2010, orders = "Y"),y = 7), 
    size = 3, color = "grey")