Re: [R] annotate

2023-10-05 Thread Paul Murrell
Hi You could use the 'gggrid' package, which gets you access to other coordinate systems. For example, the following places the text labels 2mm above the (centres of the) data points (bottom-justified) ... library(gggrid) labels <- function(data, coords) { textGrob(data$label,

Re: [R] annotate

2023-10-05 Thread Rui Barradas
Às 20:34 de 04/10/2023, Subia Thomas OI-US-LIV5 escreveu: Colleagues, I wish to create y-data labels which meet a criterion. Here is my reproducible code. library(dplyr) library(ggplot2) library(cowplot) above_92 <- filter(faithful,waiting>92) ggplot(faithful,aes(x=eruptions,y=waiting))+ g

Re: [R] annotate

2023-10-05 Thread Eric Berger
Another approach (still seems to require experimentation to get the value '2') would be to replace the annotate() with geom_text(data=above_92, aes(x=eruptions,y=waiting, label=waiting), nudge_y=2) At least this makes clear the reason for the magic number '2' in the code. For details see ?geom_t

Re: [R] Annotate question

2020-02-19 Thread Rui Barradas
Hello, If groups are factors, pass the level you want to annotate. This works, note the 'x' value: ggplot(iris, aes(Species, Petal.Length)) + geom_boxplot() + annotate(geom = "text", x = "versicolor", y = 6, label = "16 u") Hope this helps, Rui Barradas Às 20:26 de 19/02/20, Thomas Subi

Re: [R] Annotate question

2020-02-19 Thread Stefan Schreiber
Since factor levels (groups) are coded by integers, you can use 1, 2, 3 etc. as your x values. If you want to annotate in between you can simply pick values in between 1, 2, 3, etc. On Wed, Feb 19, 2020, 13:26 Thomas Subia, wrote: > Colleagues, > > To add an annotation using ggplot, I've used >

Re: [R] Annotate a segmented linear regression plot

2012-10-02 Thread David Winsemius
On Oct 2, 2012, at 3:38 PM, Ben Harrison wrote: > On 28 September 2012 16:38, David Winsemius wrote: >> >> ?text # should be fairly clear. > > Thank you. I was stupid to ask such a trivial question along with a > not-so-trivial one. The second part of the question was probably more > importan

Re: [R] Annotate a segmented linear regression plot

2012-10-02 Thread Ben Harrison
On 28 September 2012 16:38, David Winsemius wrote: > > ?text # should be fairly clear. Thank you. I was stupid to ask such a trivial question along with a not-so-trivial one. The second part of the question was probably more important: is there a way to obtain the location of segments produced b

Re: [R] Annotate a segmented linear regression plot

2012-09-27 Thread David Winsemius
On Sep 27, 2012, at 9:07 PM, Ben Harrison wrote: > Hello, > > I have produced some segmented regressions with the segmented package by > Viggo Mutteo. I have some example data and code below. I want to annotate > the individual segments with the slope parameter (actually it would be > nicer to a

Re: [R] Annotate forest plot 'forest.rma()' for meta-analysis with metafor package

2012-07-25 Thread Viechtbauer Wolfgang (STAT)
Just replace the fixed y coordinate values in the text() calls with something that will change appropriately with the number of studies/effects included in the plot. For example: text(c(-9.5,-8,-6,-4.5), res$k+2, c("TB+", "TB-", "TB+", "TB-")) text(c(-8.75,-5.25), res$k+3, c("Vaccinated", "C

Re: [R] annotate histogram

2011-11-01 Thread Tom Fletcher
See rug() and use col=2 to get red. So, as an example ... x <- rchisq(100, df=2) hist(x) abline(v=median(x), lty=2) rug(x, col=2) TF -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Wendy Sent: Tuesday, November 01, 2011 10:22 AM T

Re: [R] annotate histogram

2011-11-01 Thread Carlos Ortega
Hi, You can use function segments() to draw them. Regards, Carlos Ortega www.qualityexcellence.es 2011/11/1 Wendy > Hi all, > > I want to make a histogram like the one show > http://nar.oxfordjournals.org/content/39/suppl_1/D1011/F1.expansion.html > here , but I did not figure out how to add