Skip to main content

Questions tagged [geom-text]

`geom_text` is the geometric object description for creating text-labels in a plot in `ggplot2`

0 votes
1 answer
54 views

How do you add both data frame values and math operators to geom_text in R? [closed]

I'm attempting to use geom_text to create a label 'Ankle Absorption W = -0.52 - 0.13 x Hop Height'. My understanding is that I need to use %*% within expression() to output the x sign. The numbers are ...
D.O.'s user avatar
  • 3
1 vote
1 answer
19 views

In r: geom_text label shifts horizontal position between dodged bars

In the following ggplot in r, I would like my "n" labels to be aligned with the left side of each bar — as they are on the pink bars but not on the blue bars. Somehow, the dodging is not ...
Noa Perlmutter's user avatar
1 vote
3 answers
37 views

Using geom_text or geom_label inside geom_bar

I am plotting the publication of scientific papers on a specific research topic on a timeline. I would like to add author and year to the corresponding rectangles using the "label" variable. ...
Milena's user avatar
  • 13
1 vote
1 answer
21 views

How to adjust position of geom_text() with counts of zero for bars of barplot with geom_bar() in different groups?

I'm trying to add values at the top of my bars of a barchart with two groups. It works fine for values above zero. But I have also levels where there were no counts, so bars with the hight of 0. Then ...
Hildrun Walter's user avatar
0 votes
1 answer
44 views

Is there a way in ggplot2 to fit several columns of text, minimising the space between them?

I'm trying to use RStudio and ggplot2. I have a list of studies, some information about their data and another couple of columns of numbers. What I would like is a plot where I could fix the size of ...
Simon Turner's user avatar
0 votes
1 answer
30 views

How to adjust the symbols overlayed over a bar plot?

I have created a divergent bar plot, and after the plot is created I want to add several symbols in order to indicate some information about then as a footnote. I provide the code to create the object ...
Javier Hernando's user avatar
-1 votes
1 answer
30 views

How to get geom bar percentages to reflect within-group percentages rather than the overall percentage [closed]

I have a dataset in R that looks like this: With the following code I get the graph below: ggplot(subset(f,!is.na(d)),aes(x=d,y=(..count..)/sum(..count..),fill=forcats::fct_rev(e))) + geom_bar(...
Mike Wang's user avatar
0 votes
1 answer
49 views

ggplot2 faceting and adding unique labels for each facet in a for loop in R

I am trying to add a unique label to each faceted panel in my plots. Below is the code which I annotated and will describe in detail below: ebird <- left_join(ebird, cor, by = ...
Nick's user avatar
  • 145
0 votes
1 answer
27 views

How to swap labels on stacked bar graph using geom_text?

When producing a stacked bar graph that has different color by facet variable and bar fill variable, I would like to add the number/count by each color. I am using the geom_text function by it seems ...
enat_b's user avatar
  • 30
0 votes
0 answers
20 views

Why does there occur an a in my legend color boxes? (pie charts using coord_polar() and facet_wrap() )

I've created pie charts using geom_bar() and coord_polar(). Finally, I've got my graph as I wanted it besides of this: There occurs an letter (a small "a") in my legend boxes and I don't ...
Hildrun Walter's user avatar
0 votes
1 answer
29 views

Overlay text when using geom_text and facet_wrap in R

I'm having some trouble with the geom_text combined in facet_wrap function in RStudio. I wanted to insert the R^2 of each function in each graph created with the ggplot2 library. I've summyrised the R^...
Andrea Pagliai's user avatar
0 votes
1 answer
25 views

In `ggfittext::geom_fit_text` , it seems can't use `vjust`

In ggfittext::geom_fit_text , it seems can't use vjust . Below amount and value are override . Anyone can help on this ? Thanks library(tidyverse) library(ggfittext) diamonds %>% group_by(color,...
anderwyang's user avatar
  • 2,235
0 votes
1 answer
32 views

ggplot: Avoid geom_text() being placed over each other

I have the following common scenario: I have climate data observations and predicitons for a certain point. To evaluate the model performance the data gets plotted in a line plot and the metrics ...
talocodat's user avatar
0 votes
1 answer
43 views

How do you format the text displayed by geom_text_contour?

MWE: library(metR) heat_palette = c("darkred", "red", "yellow", "#00A600", "darkgreen") heatmap_of_percentage <- function(percent) { # display &...
Mohan's user avatar
  • 8,293
0 votes
0 answers
28 views

I want the x-axis label to set the color according to the ONTOLOGY classification, so I use geom_text() to add the label

I want the x-axis label to set the color according to the ONTOLOGY classification, but axis.text cannot complete such an operation, so I hide the original x-axis label and use geom_text() to add the ...
Jian Rao's user avatar

15 30 50 per page
1
2 3 4 5
40