Questions tagged [geom-text]

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

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

ggplot2 is an actively maintained open-source chart-drawing library for R.

540 questions
5
votes
1 answer

How to add greek letters to a label in geom_text() label in ggplot2

I am trying to label the tiles in geom_tile with the Greek symbol, kappa, as follows kappa = value I've tried using expression() and bquote() but cannot find a way to make it work df = data.frame(x = letters[1:10],y = letters[11:20], value =…
L.D.
  • 51
  • 3
5
votes
2 answers

Annotating text on individual facet in ggplot2 using geom_text

With the following code, I obtain text on each facet but the text is superimposed : "X1" and "X2" are superimposed on each facet. Where is the problem in my code ? R code : new_df <- data.frame(f = as.factor(rep(1:2, 15)), x = rnorm(30), y =…
Sebastien
  • 51
  • 1
5
votes
1 answer

How to type subscripts in geom_text labels in ggplot

I have timeseries data plotted and separated by timepoints that I'd like to label with subscripts. Below is the code I'm using to generate the figure and timepoint labels. I'd like for the -1, 3 and 6 to be subscripts. Thanks in…
user10495589
5
votes
3 answers

How to add a complex label with italics and a variable to ggplot?

I have read many postings on this topic using expression(), paste(), and bquote(), or some combination. I think I am close to solving my problem, but I just can't get there. The following script generates a plot labelled with "y = 1 + 2(x); r^2=…
JPollock
  • 53
  • 4
5
votes
1 answer

geom_text not properly positioned when using position_dodge(preserve="single") in bar plot

With the code below the labelling in facet bB is not correctly positioned. The problem seems to originate from the fact that there is no position_dodge(preserve="single") for geom_text (correct?). I am aware that I could 'manually' add an empty…
zoowalk
  • 2,018
  • 20
  • 33
5
votes
1 answer

Text repel with a position argument in ggplot/R

I am trying to make a geom_point where the text labels both repel, and point to their associated points even if I am using position=dodge or position=jitter. I also have a lot of points to label, which is why I want to use ggrepel or something…
Stonecraft
  • 860
  • 1
  • 12
  • 30
5
votes
1 answer

Geom_text with two labels in ggplot graph

I'm struggling with an additional label that I would like to add to my ggplot graph. Here is my data set: Group Gaze direction Counts Duration Expert Performers game table 148 1262.122 Expert Performers …
Jo-Achna
  • 315
  • 1
  • 3
  • 14
5
votes
1 answer

How to change font size in geom_text() outside plot area?

I'd like to annotate a plot and I'd like the note to be outside the plot area. I found this solution and it works for adding a note outside the plot area, but I cannot figure out how to change the label's appearance (most importantly, for my…
Ole
  • 107
  • 3
  • 7
5
votes
3 answers

Overlapping points and text with plotly in Rshiny

I am using plotly with Rshiny to create a scatter plot with text labels. Below is a reproducible example: library(ggplot2) library(plotly) dat <- data.frame(LongExpressionValue = rnorm(1:100), LongMethylationValue = rnorm(1:100),…
Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
5
votes
2 answers

R ggplot2: add text to geom_tiles

I need to show the results of a clustering. For demo, please see library(ggplot2) df = data.frame(cluster=c(1,1,2,2,2,3),states=c("AB","IN","UN","CH","LO","OK")) p2<-ggplot(df,aes(x=1,y=states,fill=factor(cluster)))+ geom_tile()+ …
John
  • 1,779
  • 3
  • 25
  • 53
5
votes
1 answer

extreme value labels in geom_boxplot

I am trying to add the labels for extreme values (outliers or not) on geom_box plots. I found this question, which is almost exactly similar to mine [ extreme value labels ggplot2 in geom_boxplot ] The answer provided by yonicd almost works for…
Hugo
  • 63
  • 6
5
votes
2 answers

plotly not getting geom_text in R / ggplot

I have a ggplot that works fine by its own. But when I try to import it in to the plotly api system, the geom_text seems to not work - everything else works. Can anyone help me? Here's my R version - R version 3.1.2 (2014-10-31) and plotly version -…
5
votes
3 answers

geom_text does not appear using scale_y_log10

I can add text to a ggplot using geom_text just fine (example using the cars database): ggplot(cars, aes(speed, dist), color='blue') + geom_point(size=0.8) + geom_text(y=25, x=5, aes(label=paste("sigma == 1"), size=1.5), hjust=0, parse=TRUE,…
Joseph Kreke
  • 667
  • 1
  • 7
  • 18
4
votes
1 answer

Is there a way in R to move all my labels off the map (into the margins)?

I am working on creating a choropleth map in R with certain cities and certain providers plotted as points on top of the map. I'm stuck with getting the names of the providers to move off the map into the margins (either at the top, to the right, or…
mkelley
  • 105
  • 5
4
votes
2 answers

gghighlight (R): Labeling bar charts

Alright, after a long silent read along, here's my first question. I am trying to add corresponding labels of unhighlighted items for a grouped barplot. When I insert gghighlight in front of the geom_text I get the following…
Arno
  • 43
  • 6
1 2
3
35 36