Comments (4)
I can confirm that having control over the tip_length when using stat = 'identity' would be very useful
Thanks for looking into it!
from ggsignif.
Hi thanks for raising the issue. You are right that this is confusing that tip_length
has no effect if stat = "identity"
, but this is actually the intended behavior.
If stat="signif"
I am internally computing the correct starting and end points for the lines which are subsequently passed to the geom_signif(stat="identity", ...)
.
So to add tips if stat = "identity"
you will need to do something like this:
dat <- data.frame(Group = c("S1", "S1", "S2", "S2"),
Sub = c("A", "B", "A", "B"),
Value = c(3,5,7,8))
ggplot(dat, aes(Group, Value)) +
geom_bar(aes(fill = Sub), stat="identity", position="dodge", width=.5) +
geom_signif(stat="identity",
data=data.frame(x=c(0.875, 0.875, 1.125), xend=c(0.875, 1.125, 1.125),
y=c(5.3, 5.8, 5.8), yend=c(5.8, 5.8, 5.3),
annotation=c("***")),
aes(x=x,xend=xend, y=y, yend=yend, annotation=annotation))
I understand that this might seem tedious, so I am considering adding another stat (maybe stat="signifmanual"
), which simplifies this but this would be a little bit more work.
from ggsignif.
Indeed this makes sense. I hadn't realized the length of y
and yend
wasn't necessarily the same as the data in your code here https://github.com/Artjom-Metro/ggsignif/blob/master/R/significance_annotation.R#L71
If it's just a matter of passing a tip extremity as 1st value e.g. y = c(y_lower_tip, y_bar, y_bar)
then it's not as bad as I thought: I feared the whole layer had to be altered, and since I'm not familiar with how they are coded, i was expectign something complicated.
This might warrant a mention in the vignette though, maybe replace the identity
example with the one you just posted here including a comment on the length of y/yend vectors.
Thanks for the input though!
from ggsignif.
Hi, I have just released a new version 0.3.0 that simplifies the definition of custom locations, by adding a xmin
and xmax
parameter to the function.
dat <- data.frame(Group = c("S1", "S1", "S2", "S2"),
Sub = c("A", "B", "A", "B"),
Value = c(3,5,7,8))
ggplot(dat, aes(Group, Value)) +
geom_bar(aes(fill = Sub), stat="identity", position="dodge", width=.5) +
geom_signif(annotation="***",
y_position=5.8, xmin=0.875, xmax=1.125, tip_length = 0.01)
As you see, it is no longer necessary to use stat="identity"
and also the tip_length
parameter works.
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
- Where can we find the significance level in the ggplot object slots? HOT 1
- 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.