const-ae / ggsignif

Easily add significance brackets to your ggplots
https://const-ae.github.io/ggsignif/
GNU General Public License v3.0
593 stars 43 forks source link

Move labels below lines #53

Closed ghost closed 5 years ago

ghost commented 5 years ago

Is there a way to put the label below the line? I'm working on a graph with negative values, so the bars are above the annotation, and I'd like the line to be above the annotation as well (thus, the line would fall between the bar and the annotation).

const-ae commented 5 years ago

Hi, I think the easiest way is to use the vjust argument like this:

library(tidyverse)

tibble(y = rnorm(100, mean = -5),
       group = rep(LETTERS[1:4], each = 25)) %>%
  ggplot(aes(x= group, y=y)) +
  geom_boxplot() +
  ggsignif::geom_signif(comparisons = list(c("A", "B")), y_position = -7.5, 
                        tip_length = 0, vjust=2)

Created on 2019-03-14 by the reprex package (v0.2.1)

I will close the issue for now, but if this is not resolving your problem or if I misunderstood something, feel free to comment below.