Skip to content

📍 Repel overlapping text labels away from each other in your ggplot2 figures.

License

Notifications You must be signed in to change notification settings

slowkow/ggrepel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e72a66d · Nov 4, 2024
Oct 12, 2023
Oct 23, 2024
Sep 7, 2024
Oct 23, 2024
Nov 6, 2022
May 1, 2018
Oct 23, 2024
Jan 2, 2024
Nov 4, 2024
Dec 4, 2023
Jan 3, 2024
Nov 4, 2024
Nov 28, 2016
Nov 11, 2021
Nov 4, 2024
Jan 9, 2024
Dec 15, 2020
Nov 23, 2016
Jan 9, 2024
Nov 4, 2024

Repository files navigation

ggrepel

Build Status CRAN_Status_Badge CRAN_Downloads_Badge

Overview

ggrepel provides geoms for ggplot2 to repel overlapping text labels:

  • geom_text_repel()
  • geom_label_repel()

Text labels repel away from each other, away from data points, and away from edges of the plotting area.

library(ggrepel)
ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
  geom_text_repel() +
  geom_point(color = 'red') +
  theme_classic(base_size = 16)

Installation

# The easiest way to get ggrepel is to install it from CRAN:
install.packages("ggrepel")

# Or get the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("slowkow/ggrepel")

Usage

See the examples page to learn more about how to use ggrepel in your project.

Examples

Click one of the images below to go to see the code example:

Hide some of the labels Always show all labels, even when they have too many overlaps Do not repel labels from data points Do not repel labels from plot (panel) edges Expand the scale to make room for labels Always (or never) draw line segments Make curved line segments or arrows Repel labels from data points with different
sizes Limit labels to a specific area Remove “a” from the legend Align labels on the top or bottom edge Align labels on the left or right edge Using ggrepel with stat_summary() Justify multiple lines of text with hjust Label jittered points Nudge labels in different directions with ggpp Label sf objects Shadows (or glow) under text labels Verbose timing information Word cloud Polar coordinates Unicode characters (Japanese) Mathematical expressions

Contributing

Please submit an issue to report bugs or ask questions.

Please contribute bug fixes or new features with a pull request to this repository.

About

📍 Repel overlapping text labels away from each other in your ggplot2 figures.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages