Questions tagged [ggrepel]

ggrepel: Repulsive Text and Label Geoms for 'ggplot2' Provides text and label geoms for 'ggplot2' that help to avoid overlapping text labels. Labels repel away from each other and away from the data points.

Repulsive Text and Label Geoms for

Description

Provides text and label geoms for 'ggplot2' that help to avoid overlapping text labels. Labels repel away from each other and away from the data points.

Repositories

206 questions
4
votes
2 answers

ggrepel: plot labels above points

I want to plot labels precisely above points where possible (no overlap), but ggrepel seems to insist on plotting slightly above or below. E.g. require(ggplot); require(ggrepel) ggplot(iris[1:10,], aes(Sepal.Length, Sepal.Width)) + …
geotheory
  • 22,624
  • 29
  • 119
  • 196
3
votes
1 answer

Getting transition_states, geom_label_repel and enter_fade to work together

I'm drawing a scatterplot where I'd like to highlight different observations as time passes. Sometimes, these observations are close together, so I'm using geom_label_repel to do so. I'd also like to use enter_fade and exit_fade in order to make…
markrt
  • 97
  • 5
3
votes
3 answers

Move ggrepel / geom_text_repel's labels away from lines drawn with geom_vline() and geom_hline()

ggrepel provides an excellent series of functions for annotating ggplot2 graphs and the examples page contains lots of nice hints of how to expand its functionality, including moving the labels generated away from both the axes of the plot, other…
Landak
  • 904
  • 14
  • 26
3
votes
1 answer

R: ggrepel, ggplot2 labels above the plotting area

In would like to plot density plots with certain values (for instance: median/mean/etc.). I also would like to display chosen values (for instance median) above the plotting area, so it would not interfere with the distributions itself. Also, in…
ramen
  • 691
  • 4
  • 20
3
votes
1 answer

Repel labels in ggrepel away from arrowheads

I'm creating some DAGs using the ggdag package, which is a wrapper around ggplot and ggrepel. Because the text doesn't fit into the nodes I'm using geom_dag_label_repel, which is a wrapper around ggrepel's geom_label_repel. Unfortunately the labels…
jonnyf
  • 198
  • 8
3
votes
2 answers

How to adjust ggrepel label on pie chart?

I am trying to create a pie chart to visualize percent abundance of 9 genera. However, the labels are all clumping together. How do I remedy this? Code included below: generaabundance2020 <- c(883, 464, 1948, 1177, 2607, 962, 2073, 620,…
Abby L
  • 75
  • 8
3
votes
1 answer

How to not have percentage labels overlap (repel percentage labels) in Likert bar plot?

I'm still relatively new to R, so any help here is very appreciated. I created a Likert bar plot, but some of the percentages shown on the plot overlap. I am wondering how to prevent this overlap from occurring? I read about ggrepel, and tried to…
kpgr
  • 31
  • 2
3
votes
1 answer

Can I control the order of multiple labels for the same value using geom_text_repel?

I'm making a plot where several data points have the same coordinates. By default, the labels all overlap, but using geom_text_repel with direction = "y", I can vertically space them out. However, every time I generate the plot, it chooses a new…
Oona Luna
  • 33
  • 2
3
votes
1 answer

Set limits within ggplot for ggrepel

I have a ggplot graph with data similar to this: data <- data.frame(x = c(1:30), y = rnorm(30, 0, 1), z = rep(c("A", "B", "C"), 10)) ggplot(data = data, aes(x = x, y = y, group = z, color = z, label = z)) + …
Marco Pastor Mayo
  • 803
  • 11
  • 25
3
votes
2 answers

How to add direct labels to a bar chart in ggplot for numeric x axis

I am trying to create a bar chart in ggplot where the widths of the bars are associated with a variable Cost$Sum.of.FS_P_Reduction_Kg. I am using the argument width=Sum.of.FS_P_Reduction_Kg to set the width of the bars according to a variable. I…
3
votes
2 answers

How do I get this label to point to the leftmost bar?

I tried the following code but instead of showing the label in middle, I want to point it to leftmost (you can see my picture under). Thanks for the help! library(tidyverse) library(ggrepel) mtcars %>% group_by(am, cyl) %>% slice(1) %>% …
numerairX
  • 147
  • 5
3
votes
1 answer

removing space between ggrepel label made using plotmath

I am creating a plot where I want to display labels using ggrepel. I am showing a minimal example below that illustrates how the label has two components separated by a comma - first related to the type of iris flower species and the second to the…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
3
votes
1 answer

Move labels from geom_label_repel into ggplot margin

In the plot below I'd like to move the label "V-Engine" into the plot margin. Adjusting the nudge_x argument is moving the "S-Engine" label but not the "V-Engine" label. library(ggplot2) library(ggrepel) library(dplyr) ds <- mtcars %>% …
Joe
  • 3,217
  • 3
  • 21
  • 37
3
votes
1 answer

Vertically align geom_label elements

Problem I am trying to vertically align geom_label's on a line chart without visibly extending the x-axis. Is there a way I can make white space on the right of the chart so that the ggrepel function (below) has space to work? I am trying to…
Dom
  • 1,043
  • 2
  • 10
  • 20
3
votes
1 answer

Error - Visualisation data in ggplot2 with ggrepel package

I tried to draw a graph in the ggplot2 library with the addition of ggrepel: set.seed(42) ggplot(mtcars) + geom_point(aes(wt, mpg), size = 5, color = 'grey') + geom_label_repel(aes(wt, mpg, fill = factor(cyl), label = rownames(mtcars)), …
Denmla
  • 135
  • 1
  • 8