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

Change asterisks size? #17

Closed Ni-Ar closed 7 years ago

Ni-Ar commented 7 years ago

Hi,

very nice package! One question: -is it possible to specifically change only the size (or colour) of the asterisks on top of the line, instead of changing only the line size? I tried the argument size = x, but that works only for the line and not for the asterisks.

Many thanks, Ni-Ar

Jacq3lin3 commented 7 years ago

Hello,

I agree with @Ni-Ar , very nice package indeed! I found myself wondering the same and facing the same issues.

Thanks for the help, J

const-ae commented 7 years ago

Hi, I am happy to heat that you like the package.

The option to change the text is called textsize:

library(ggplot2)
library(ggsignif)
ggplot(mpg, aes(class, hwy)) +
  geom_boxplot() +
  geom_signif(comparisons = list(c("compact", "midsize"), c("minivan", "suv")),
              map_signif_level = TRUE, textsize=10, family="serif") +
  ylim(NA, 50)

plot with changed textsize

angoodkind commented 1 year ago

This no longer seems to be working.

IndrajeetPatil commented 1 year ago

@angoodkind Can you please provide a reproducible example?

Because the stated solution still works for me:

library(ggplot2)
library(ggsignif)

ggplot(mpg, aes(class, hwy)) +
  geom_boxplot() +
  geom_signif(
    comparisons = list(c("compact", "midsize"), c("minivan", "suv")),
    map_signif_level = TRUE, textsize = 10, family = "serif"
  ) +
  ylim(NA, 50)
#> Warning in wilcox.test.default(c(29, 29, 31, 30, 26, 26, 27, 26, 25, 28, :
#> cannot compute exact p-value with ties

Created on 2022-12-19 with reprex v2.0.2

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.2 (2022-10-31) #> os macOS Ventura 13.0.1 #> system aarch64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Europe/Berlin #> date 2022-12-19 #> pandoc 2.19.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.4.1 2022-09-23 [1] CRAN (R 4.2.0) #> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0) #> curl 4.3.3 2022-10-06 [1] CRAN (R 4.2.1) #> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) #> dplyr 1.0.99.9000 2022-11-30 [1] Github (tidyverse/dplyr@0d25b6b) #> evaluate 0.19 2022-12-13 [1] CRAN (R 4.2.2) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) #> farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.1) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) #> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.1) #> ggplot2 * 3.4.0 2022-11-04 [1] CRAN (R 4.2.2) #> ggsignif * 0.6.4 2022-10-13 [1] CRAN (R 4.2.1) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) #> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.1) #> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0) #> htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.2) #> httr 1.4.4 2022-08-17 [1] CRAN (R 4.2.0) #> knitr 1.41 2022-11-18 [1] CRAN (R 4.2.2) #> labeling 0.4.2 2020-10-20 [1] CRAN (R 4.2.0) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) #> mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0) #> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) #> purrr 0.9000.0.9000 2022-12-14 [1] Github (tidyverse/purrr@00fc8aa) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0) #> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.2.2) #> R6 2.5.1.9000 2022-10-27 [1] local #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1) #> rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.1) #> rmarkdown 2.19 2022-12-15 [1] CRAN (R 4.2.2) #> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1) #> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) #> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1) #> stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.2) #> styler 1.8.1.9000 2022-12-14 [1] Github (r-lib/styler@3a72387) #> tibble 3.1.8.9002 2022-10-16 [1] local #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.1) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) #> vctrs 0.5.1 2022-11-16 [1] CRAN (R 4.2.2) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0) #> xfun 0.35 2022-11-16 [1] CRAN (R 4.2.2) #> xml2 1.3.3.9000 2022-10-10 [1] local #> yaml 2.3.6 2022-10-18 [1] CRAN (R 4.2.1) #> #> [1] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
angoodkind commented 1 year ago

Ah, it looks like the problem was in trying to load the theme before ggsignif, e.g. theme_bw().