r/RStudio • • 2d ago

Coding help Annotating Graph

Post image

This is an example of a primary productivity heatmap I made in R. I'm wondering if anyone knows a way for me to label the bodies of water in this figure (North Atlantic, Hudson Bay, etc.), or will I have to do this manually in pptx? Made using ggplot2 and terra. Thanks for the help!

11 Upvotes

6 comments sorted by

6

u/DataScienceFor_All 2d ago

The fact that you are able to create this kind of plot shows you know R, so I'm a little surprised you are struggling with annotations (just a joke on my part).

Explore the tidyplots package for which makes it easy to annotate plots with the add_annotation_*() function layer. This has been very helpful to me personally.

Good luck!

1

u/novica 1d ago

ggindex will help you with a legend it you don’t want the labels in the map

1

u/Simpologist 1d ago

Thanks I will try this! I tried what another user mentioned and it being labeled on the map directly obscured what I’m trying to get across.

1

u/novica 1d ago

if you can, let me know how it goes :)

1

u/AutoModerator 2d ago

Looks like you're requesting help with something related to RStudio. Please make sure you've checked the stickied post on asking good questions and read our sub rules. We also have a handy post of lots of resources on R!

Keep in mind that if your submission contains phone pictures of code, it will be removed. Instructions for how to take screenshots can be found in the stickied posts of this sub.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/FlyingDoctor 2d ago

Geom_text or geom_sf_text