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
8
votes
1 answer

geom_label_repel text justification and alignment

Is there a possible work-around to left-justify the text label created by geom_label_repel (or geom_text_repel) in the example below where all text are placed with positive nudge_x value and y-only adjusted position in direction parameter? …
Djork
  • 3,319
  • 1
  • 16
  • 27
8
votes
2 answers

Using ggfortify and ggrepel for pca

I am running a principal component analysis with a varimax rotation and wish to display the plot which seems simple enough, however my loading vectors are very close in some places and the labels of which factor they are tend to overlap. That is…
E. Nicholson
  • 105
  • 1
  • 5
7
votes
1 answer

How to stop ggrepel labels moving between gganimate frames in R/ggplot2?

I would like to add labels to the end of lines in ggplot, avoid them overlapping, and avoid them moving around during animation. So far I can put the labels in the right place and hold them static using geom_text, but the labels overlap, or I can…
monkeytennis
  • 848
  • 7
  • 18
7
votes
2 answers

Add direct labels to geom_smooth rather than geom_line

I recognize that this question is a close duplicate of this one, but the solution there no longer works (using method="last.qp"), so I'm asking it again. The basic issue is that I'd like to use directlabels (or equivalent) to label smoothed means…
phalteman
  • 3,442
  • 1
  • 29
  • 46
7
votes
1 answer

Is it possible to avoid axis label overlapping by ggrepel?

I am drawing heatmap with ggplot2. Several ticks on y axis need to be labeled. However,some of them are too close and overlap. I know ggrepel could separate text labels, but currently I have not worked out for my problem. My code is as following.…
PengY
  • 73
  • 1
  • 4
7
votes
1 answer

ggplot2 pie plot with geom_text_repel

I am plotting multiple pie plots with ggplot2 and succeeded in having the labels plotted in the right positions, as: df <- data.frame(annotation=rep(c("promoter", "intergenic", "intragene", "5prime", "3prime"), 3), value=c(69.5, 16, 10.7, 2.5, 1.3,…
sargg
  • 323
  • 3
  • 8
6
votes
2 answers

Programmatically label multiple ablines in R ggplot2

There are existing questions asking about labeling a single geom_abline() in ggplot2: R ggplot2: Labelling a horizontal line on the y axis with a numeric value R ggplot2: Labeling a horizontal line without associating the label with a series Add…
Hendy
  • 10,182
  • 15
  • 65
  • 71
6
votes
1 answer

How to avoid overlap of labels in a plot using geom_label_repel?

I am trying to make a volcano plot with huge data. Showing some data here. tab7 <- structure(list(logFC = c(-1.27422400347856, -0.972370320302353, -1.63545104297305, 0.921263558062452, -0.922767678335555, 1.12992019747864, -1.12813908449641,…
beginner
  • 1,059
  • 8
  • 23
6
votes
1 answer

How do I send arrows which cover other labels to the back in geom_label_repel?

This should seem fairly straight forward but I can't find any argument to do this with ggrepel::geom_label_repel(). Sample of data: df <- structure(list(Athletename = c("Aries Merritt", "Damian Warner" ), Score = c(12.8, 13.44), Event = c("110m…
Nautica
  • 2,004
  • 1
  • 12
  • 35
6
votes
1 answer

Increasing spacing between labels for geom_line plot

Suppose I have some set of lines that I plot using ggplot and geom_line. I want to label these lines. I can do this using geom_dl from the directlabels package, but even with the provided method to avoid overlaps (e.g. "last.qp"), I still think that…
tbadams45
  • 848
  • 1
  • 8
  • 19
6
votes
1 answer

Control colour of geom_text_repel

I would like to change the colour of one of my ggrepel labels to black. I have tried to override the inheritance by specifying ...geom_text_repel(...colour='black') but that doesn't seem to work. My attempt at a fix to the problem is in the second…
Dom
  • 1,043
  • 2
  • 10
  • 20
6
votes
1 answer

How to label an individual state on the map while the others at sub-divisional level

I've managed to produce a map, however I need to add one label for a state (level 2) that includes subdivisons (level 3), instead of labeling each subdivision (for only this state). In data "newpak" rows 641-664 correspond to this state, is there…
Researcher
  • 149
  • 1
  • 8
5
votes
0 answers

Set Anchor point geom_text_repel/geom_label_repel to be the same for all labels (left side)

I am am using a geom_text_repel, kind of based on this example: https://ggrepel.slowkow.com/articles/examples.html#align-labels-on-the-top-or-bottom-edge. However, in my code, the end of the line segment sometimes snaps to the left side of the label…
L Smeets
  • 888
  • 4
  • 17
5
votes
1 answer

Using ggrepel and shadowtext on the same geom_text

I have a plot (made in R with ggplot2) that's the result of some singular value decomposition of a bunch of text data, so I basically have a data set of ~100 words used in some reviews and ~10 categories of reviews, with 2D coordinates for each of…
lmhamilt
  • 127
  • 2
  • 8
5
votes
2 answers

Override horizontal positioning with ggrepel

I'm working on a chart similar to a slopegraph, where I'd like to put labels along one or both sides with ample blank space to fit them on both sides. In cases where labels are very long, I've wrapped them using stringr::str_wrap to place…
camille
  • 16,432
  • 18
  • 38
  • 60
1
2
3
13 14