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

Combine labels with `geom_text_repel`?

How would I create a label that accounts for two points? In this example I am interested in making a label that is the sum of the the "6" and the "8" bars and has a line pointing to each of them. Currently I…
John-Henry
  • 1,556
  • 8
  • 20
2
votes
0 answers

Aligning labels in geom_text_repel

The problem I am trying to replicate the text alignment and even spacing as in hjust = 0 panel from the ggrepel examples: My plot The difficulty is that I have concatenated multiple string into single labels so that the line segments don't make the…
Dom
  • 1,043
  • 2
  • 10
  • 20
2
votes
0 answers

DiagrammeR - how to move labels outside of nodes

How can I move labels outside of the circles utilizing R's DiagrammeR package? I don't see anything in the instruction manual. Here's my code. In my opinion it's not visually appealing to have the labels inside the circles. If I could apply ggrepel…
Display name
  • 4,153
  • 5
  • 27
  • 75
2
votes
2 answers

adjust x and y scales for individual facets in facet_grid() to fit geom_text_repel() labels?

I need to manually specify the limits of both the x and y axes for each facet (3 rows and 3 columns) in a facet_grid. I have 2 categorical factors and a continuous y value (so I'm plotting the catch_ema_thousands on the y axis, with data faceted by…
leslie roberson
  • 167
  • 1
  • 15
2
votes
1 answer

Move ggrepel long labels to right of plot lines

I wish to move the label fully to the right of the plot line. I do not wish to extend the x-axis any further. I just need to create space. How do I do this? library(tidyverse) library(ggrepel) df <- tibble( x = as.Date(c("1990-01-01",…
ixodid
  • 2,180
  • 1
  • 19
  • 46
2
votes
2 answers

Automatic outlier labeling in ggplot

I have used ggplot in a loop to generate scatter plots for each of my 200 variables-V1, V2,etc. To make the scatter plots clearer, I would like to be able to label the outliers, automatically. I want to label the points that are greater than the…
Skurup
  • 205
  • 3
  • 10
2
votes
1 answer

Justifying lines of text within individual ggrepel labels

I have a plot where I'm labelling elements with multi-line ggrepel labels. I'd like to right-justify within some of these and left-justify within others. See example: p <- ggplot() + coord_cartesian(xlim=c(0,1), ylim=c(0,1)) + …
phalteman
  • 3,442
  • 1
  • 29
  • 46
2
votes
0 answers

Repel geom label and text in ggplot. And ordering geom points based on size

I have 2 data frames such as these: df1 <- data.frame( party = c("Blue Party", "Red Party"), dim1 = c(0.03, -0.04), dim2 = c(-0.05, 0.02), sz = c(34, 42) ) df2 <- data.frame( var = c("Economic", "Gov trust", "Inst trust", "Nationalism",…
Marco Pastor Mayo
  • 803
  • 11
  • 25
2
votes
0 answers

Plotting PCA with ggbiplot results in labels overlapping. How to plot with PCA with ggplot?

I am trying to plot principle components. I am using the following code. One problem I am running into is that the labels for variables are too close to each other. I read that using ggrepel solves this problem. Here is an example data EDIT1:…
DiscoR
  • 247
  • 2
  • 11
2
votes
0 answers

How to fix names on map and Warning message in r(ggmap,ggplot)

I have created world map that display's country's names on world map. However,My issue is that all the names are overlapping with each other making it hard to see on the map and another issue is that R is displaying warning message saying "missing…
Data_is_Power
  • 765
  • 3
  • 12
  • 30
2
votes
1 answer

using plotmath in ggrepel labels

I am trying to create a plot where I want to show all coefficients from my linear model and their respective statistical details attached at each point using ggrepel package. I have managed to create the basic plot, but what I haven't been able to…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
2
votes
1 answer

ggplot2 - separating box plot labels by colour

I am trying to create a box plot with labels for some of the individal data. The box plot is separated by two variables, mapped to x and colour. However when I add labels using geom_text_repel from the ggrepel package (necessary for the real data)…
Lucy Wheeler
  • 271
  • 3
  • 17
2
votes
2 answers

Wrap long text in a text box

I have the following reproducible coefficient plot. library(tidyverse) tribble(~term, ~estimate, ~lower, ~upper, ~text, "a", .25, .2, .3 , "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sit amet orci vel dolor luctus…
Alex
  • 2,603
  • 4
  • 40
  • 73
2
votes
2 answers

How do I include strikethrough text in geom_text_repel or geom_text labels for ggplot?

Is it possible to add strikethrough to some geom_text/geom_text_repel labels? This question mentioned that you can italicise a label using the following: library("ggplot2") library("ggrepel") df <- data.frame( x = c(1,2), y = c(2,4), lab =…
Paul
  • 8,734
  • 1
  • 26
  • 36
2
votes
1 answer

Adding labels to a plot using ggplot2 in R

I got an error when I was using geom_text_repel to add labels to my plot. Here are the codes before adding any text labels and everything worked…
Xipu Li
  • 89
  • 1
  • 12