Comments (1)
Hi, to access annotations, you can first build the plot using ggplot_build()
and then extract a list of data frames, each corresponding to a geom. The one corresponding to geom_signif()
will have an annotation column.
library(ggplot2)
library(ggsignif)
p <- ggplot(mpg, aes(class, hwy)) +
geom_boxplot() +
geom_signif(
comparisons = list(c("compact", "midsize"), c("minivan", "suv")),
map_signif_level = TRUE
)
pb <- ggplot_build(p)
#> Warning in wilcox.test.default(c(29, 29, 31, 30, 26, 26, 27, 26, 25, 28, :
#> cannot compute exact p-value with ties
pb$data
#> [[1]]
#> ymin lower middle upper ymax outliers notchupper
#> 1 23 24.0 25.0 26.0 26 26.41319
#> 2 23 26.0 27.0 29.0 33 35, 37, 35, 44 27.69140
#> 3 23 26.0 27.0 29.0 32 27.74026
#> 4 21 22.0 23.0 24.0 24 17 23.95278
#> 5 15 16.0 17.0 18.0 20 12, 12, 12, 22 17.55009
#> 6 20 24.5 26.0 30.5 36 44, 41 27.60241
#> 7 14 17.0 17.5 19.0 22 12, 12, 25, 24, 27, 25, 26, 23 17.90132
#> notchlower x flipped_aes PANEL group ymin_final ymax_final xmin xmax xid
#> 1 23.58681 1 FALSE 1 1 23 26 0.625 1.375 1
#> 2 26.30860 2 FALSE 1 2 23 44 1.625 2.375 2
#> 3 26.25974 3 FALSE 1 3 23 32 2.625 3.375 3
#> 4 22.04722 4 FALSE 1 4 17 24 3.625 4.375 4
#> 5 16.44991 5 FALSE 1 5 12 22 4.625 5.375 5
#> 6 24.39759 6 FALSE 1 6 20 44 5.625 6.375 6
#> 7 17.09868 7 FALSE 1 7 12 27 6.625 7.375 7
#> newx new_width weight colour fill size alpha shape linetype
#> 1 1 0.75 1 grey20 white 0.5 NA 19 solid
#> 2 2 0.75 1 grey20 white 0.5 NA 19 solid
#> 3 3 0.75 1 grey20 white 0.5 NA 19 solid
#> 4 4 0.75 1 grey20 white 0.5 NA 19 solid
#> 5 5 0.75 1 grey20 white 0.5 NA 19 solid
#> 6 6 0.75 1 grey20 white 0.5 NA 19 solid
#> 7 7 0.75 1 grey20 white 0.5 NA 19 solid
#>
#> [[2]]
#> x xend y yend annotation group flipped_aes PANEL shape
#> 1 2 2 44.64 45.60 NS. compact-midsize-1 FALSE 1 19
#> 2 2 3 45.60 45.60 NS. compact-midsize-1 FALSE 1 19
#> 3 3 3 45.60 44.64 NS. compact-midsize-1 FALSE 1 19
#> 4 4 4 44.64 45.60 *** minivan-suv-2 FALSE 1 19
#> 5 4 7 45.60 45.60 *** minivan-suv-2 FALSE 1 19
#> 6 7 7 45.60 44.64 *** minivan-suv-2 FALSE 1 19
#> colour textsize angle hjust vjust alpha family fontface lineheight linetype
#> 1 black 3.88 0 0.5 0 NA 1 1.2 1
#> 2 black 3.88 0 0.5 0 NA 1 1.2 1
#> 3 black 3.88 0 0.5 0 NA 1 1.2 1
#> 4 black 3.88 0 0.5 0 NA 1 1.2 1
#> 5 black 3.88 0 0.5 0 NA 1 1.2 1
#> 6 black 3.88 0 0.5 0 NA 1 1.2 1
#> size
#> 1 0.5
#> 2 0.5
#> 3 0.5
#> 4 0.5
#> 5 0.5
#> 6 0.5
Created on 2022-08-11 by the reprex package (v2.0.1.9000)
from ggsignif.
Related Issues (20)
- Figure out where the `WARNING`s and `NOTE`s in `R CMD check` are coming from HOT 1
- Manual vertical brackets do not work: "arguments imply differing number of rows" HOT 1
- Warning message: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position HOT 3
- adding scale_y_log10 changes y-axis to a weird range
- geom_signif does not plot comparison on the facetted plot with free x scale HOT 2
- Rename default branch from `master` to `main` HOT 3
- CRAN release 0.6.4 HOT 3
- Correcting for multiple testing when using geom_signif HOT 5
- Feature request - add more distance between comparisons and data HOT 4
- geom_signif - all comparisons dissappear when one comparison has missings HOT 2
- Significance stars are misaligned when using "NS" as well
- ggsignif results don't match with anova significance HOT 1
- Use cross symbol when p <.10?
- what are * , ** , *** correspond if specific values by user is not given? HOT 1
- How do I hide the no significant (NS) comparisons?
- Adding significance bar on coupled boxplots
- FDR warning HOT 1
- Show exact p value in comparisons HOT 3
- ggsignif facetting issue - Missing significance labels in certain facets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggsignif.