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

Positioning values of stacked barchart in the center using ggplot2

I've created a stacked barchart and faceted using two variables. I'm unable to position the values in the barchart in the middle, it either appears at the extremes or overlaps. The expected image is the following: I've pasted the script below. Any…
Vinay vinay
  • 17
  • 2
  • 7
0
votes
1 answer

Aligning text on bar chart ggplot2

df.test <- data.frame(val=c(0.55,0.42,-0.05),name=letters[1:3], desc='This is the description of values' p <- ggplot(df.test, aes(name, val, label = desc)) + geom_bar(stat = "identity", col = 'black', fill = 'lightgreen') + labs(title…
H_A
  • 667
  • 2
  • 6
  • 13
0
votes
1 answer

Change name of point labels in

I know how to add point labels when using ggplot2 using geom_text() p <- ggplot(mtcars, aes(x=wt, y=mpg, label=rownames(mtcars))) p + geom_text() But what if I want to change "Fiat X1-9" to "WORST CAR EVER" without changing the entries in the…
Emilio M. Bruna
  • 297
  • 1
  • 3
  • 14
0
votes
1 answer

Adding text in stacked bar where levels are ordered using stat=summary

Here is the data: df_test<-structure(list(MIRNA = c("let-7c", "let-7c", "let-7c", "let-7c", "let-7c", "let-7c", "let-7c", "mir-125b-2", "mir-125b-2", "mir-125b-2", "mir-125b-2", "mir-125b-2", "mir-125b-2", "mir-125b-2", "mir-155", "mir-155",…
thisisrg
  • 596
  • 3
  • 12
0
votes
1 answer

R - Labels geom_point()

All, Please see below code to a R script. I am simply trying to populate a map of UK with list of stores (storeLocations) and customers (CustomerLocations). STRTRADECODE is the column name within StoreLocations table which contains name of a…
0
votes
0 answers

geom_text with faceted barplot messes up scales

Trying to facet out a barplot of survey responses. Each facet should have the percent answers to the question while annotating each facet with the number of respondants. Everything seems to work fine until add the annotation with geom_text which…
DSaeger
  • 51
  • 2
0
votes
2 answers

ggplot2 facet_wrap geom_text not accepting date values

I have a small data set, local, (5 observations) with two types: a and b. Each observation has a Date field (p.start), a ratio, and a duration. local principal p.start duration allocated.days ratio 1 P 2015-03-18 1 …
Gerry
  • 1,303
  • 1
  • 10
  • 16
0
votes
0 answers

Separate text in faceted ggplot boxplot

how can I separate the text annotations inserted by geom_text in the following boxplots? data(mtcars) ggplot(data = mtcars, aes(as.factor(vs), mpg, color = am )) + facet_wrap(~gear) + geom_boxplot() + geom_text(data=mtcars, aes(x=0.7, y = 30,…
Hendrik
  • 321
  • 1
  • 14
0
votes
0 answers

Percent labels in barplot with ggplot2

I made the following graph using ggplot2. What I seek is to add labels with percentages to each of the bars. cat.ocup.grafico<-ggplot(subset(casen8va, !is.na(o15)), aes(factor(o15), weight=expr))+ geom_bar(aes(y =(..count..)/sum(..count..)),…
Héctor Garrido
  • 185
  • 1
  • 14
0
votes
2 answers

ggplot2: geom_violin(), geom_text() with facet_grid() to print total number of rows in each factor excluding NA

In the violin plot below, I want to add total number of rows used to draw each plot excluding NA values. Input: df <- cbindX(as.data.frame(rep(c(rep("trt", 4*500), rep("trt2",4*500)),2)), as.data.frame(rnorm(15*500,2)), …
Rashedul Islam
  • 879
  • 1
  • 10
  • 23
0
votes
1 answer

Subset or Grep for selectively pasting using Geom_Text in R

I am trying to add select text using geom_text for a series of ggplots I am generating using the lapply and split functions. Essentially I am creating one ggplot per Component.name.x with each of these plots containing 3 curves - one for each…
S Wellman
  • 45
  • 10
0
votes
1 answer

ggplot geom_text not seating on top of bars

I have some data where some groups do not appear on all months. I am plotting this on a bar graph but with a text label showing the numerical values but the text are not seating on top of each bar. I tried using the position "dodge" for the labels…
user3357059
  • 1,122
  • 1
  • 15
  • 30
0
votes
0 answers

asterix R bar ggplot

I am trying to label both bars in comparison to a control and bars between conditions with asterixes to highlight significance. When I am using a sidebyside bar plot the default setting for the position of the asterixes placed by geom_text is in the…
0
votes
1 answer

Dynamic data labels in geom_bar

I am using ggplot2 geom_bar to make a series of bar charts. Each city has three data points, and I am making a graph for each city. I want to label the second and third bar in each chart as a percent of the previous bar (e.g. data that looks like 5,…
gxq9
  • 3
  • 2
0
votes
1 answer

Merging two plots in ggplot2 and keeping individual features of the plots (geom_text, geom_vline)

I have two geom_line time series with some geom_text & geom_points on each plot. One of the two plots additionally has geom_vline. I wonder if it is possible to merge two but i failed to get a solution. Here are the two…
Pat
  • 1,299
  • 4
  • 17
  • 40
1 2 3
35
36