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
0
votes
2 answers

change font familly in geom_text_repel()

Summary I would like to use AvantGarde font family in a geom_text_repel but I get an error. Minimal code example library(ggrepel) p <- ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars), colour = factor(cyl))) + geom_point() p +…
0
votes
0 answers

How to nudge multiple lines of geom_sf_text as a group in RStudio?

I want to make a choropleth map in RStudio using a geoJSON file that I read using the read_sf function and a dataframe for the heatmap and the labels. So far this is the code that I came up with: indonesia_geojson <-…
0
votes
1 answer

Geom_label_repel not properly referencing to the sec.axis

I am working with a ggplot that has two axis: one for the geom_bar component, and the other for the geom_linecomponent. And for this, I am using the sec.axis() command. I wanted to insert a box to provide the last value of the geom_line component,…
Bileobio
  • 121
  • 8
0
votes
1 answer

Labelling points with ggrepel using a second dataframe

I have two lines that I wish to label with ggrepel. I require a second, separate dataframe to have the label information. The error I get is: Error in `geom_label_repel()`: ! Problem while computing aesthetics. ℹ Error occurred in the 2nd…
ixodid
  • 2,180
  • 1
  • 19
  • 46
0
votes
1 answer

How do I separate the geom_label_repel in the geom_bar?

I want to pull away these overlapping labels in ggplot. I am seeking for help to pull away each label to avoid overlapping. I've tried modify box.padding, max.overlaps, min.segment.length but still faild. data =…
0
votes
1 answer

ggplot: Insert linebreak when label is too long

I have to produce a scatter plot with many points. I am already using the package "ggrepel" in order to avoid overlapping, but it sometimes still doesnt work. Is there a possibility to insert a linebreak into the labels (e.g. after a certain…
D. Studer
  • 1,711
  • 1
  • 16
  • 35
0
votes
1 answer

ggrepel together with geom_smooth

ggplot(gapminder::gapminder,aes(x=year,y=lifeExp,label=continent,color=continent))+ geom_line(size=.1,alpha=.2)+ guides(color="none")+ theme_minimal()+ geom_smooth(aes(color=continent),se=F,method="loess")+ ggrepel::geom_label_repel(direction =…
Misha
  • 3,114
  • 8
  • 39
  • 60
0
votes
1 answer

Use geom_label_repel only for certain observations?

I'm a football data analyst using NFL team logos as my points on a scatterplot. However, these images will sometimes cover each other up. I want to find a way to repel a label for those images that are overlapping with one another. However, I…
0
votes
1 answer

Overlapping labels in bar plot - add white background?

This is my data: structure(list(aasta = c(2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019, 2020, 2016, 2017, 2018, 2019,…
0
votes
1 answer

force ggplot to plot and includes all the annotation that is outside the plot in r

I am trying to plot a correlation matrix that includes thousands of pairwise comparisons. I am thinking to use ggplot2 in R to plot it out. There are 4 main issues would like to address (some of them have been addressed, but I can amend them if the…
William Wong
  • 453
  • 2
  • 9
0
votes
1 answer

geom_text_repel() and geom_text() generating copies of labels

I used the code below to create 2 plots. The first plot resulted in the labels overlapping and the appearance of unwanted letters in the legend. So, in the plot 2, I used the geom_text(show.legend = FALSE) and geom_text_repel(max.overlaps = Inf)…
0
votes
1 answer

ggplot2 pie chart : Repositioning ggrepel slice labels by moving them toward circumference of the pie possible?

I am trying to create a pie chart of a following data.table obj by using ggplot2; > pietable cluster N P p 1: 1 962 17.4 8.70 2: 3 611 11.1 22.95 3: …
akh22
  • 661
  • 4
  • 16
0
votes
0 answers

How to overlay two scatter plots (two points) with labels from the same individuals?

I am drawing two scatter plots with labels in the same graph. I know how to do one scatter plot with label. But I am struggling to overlay another scatter plots with labels but the each dot is the pair of the first scatter plot. In this case, can…
user10345633
  • 105
  • 4
0
votes
1 answer

How to produce neat label positions in the ggplot2 line chart?

I have a line chart built using ggplot2. It looks following: Lines are close to each other and data labels are overlapping. It is not convenient. It would be better if light red labels were below the line and green labels where there is room for…
Serhii
  • 362
  • 4
  • 15
0
votes
1 answer

How to correclty place labels in piechart using ggplot?

reprex: library(tidyverse) library(ggrepel) tibble( n = c(1, 1, 1, 2, 50, 46), label = paste0(c(1, 1, 1, 2, 50, 46), "%")) %>% ggplot(aes(x = "", y = n)) + geom_bar(width = 1, stat = "identity") + geom_text(aes(x = 1.6, label = label), …
Alvaro Morales
  • 1,845
  • 3
  • 12
  • 21