Skip to content

slowkow/ggrepel

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
May 4, 2023 15:19
R
January 22, 2023 13:29
May 4, 2023 14:18
man
November 6, 2022 15:15
November 6, 2022 14:38
src
October 17, 2022 12:06
January 22, 2023 15:46
May 4, 2023 14:13
May 4, 2023 14:13
May 4, 2023 14:18
November 28, 2016 11:54
May 4, 2023 14:37
December 14, 2020 19:20
May 4, 2023 14:13

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 22 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 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.