plotly / plotly/plotly.R

Would love to see geom_GeomBracket() to be implemented in plotly

Open
#1,976 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hello,
I am a big fan of plotly because of its interactive features and unlike any other normal static plots. I usually use ggplot to visualize my data and then use a ggplotly to make my plot into a plotly interactive plot, but for boxplot with p-value bracket , plotly does not show that feature. I would really appreciated if that feature could be added to plotly as well in the future.

df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
stat.test <- df %>%
    group_by(dose) %>%
    t_test(len ~ supp) %>%
    adjust_pvalue(method = "bonferroni") %>%
    add_significance("p.adj")
stat.test
# Create a box plot
bxp <- ggboxplot(
    df, x = "dose", y = "len", 
    color = "supp", palette = c("#00AFBB", "#E7B800")
)

# Add p-values onto the box plots
stat.test <- stat.test %>%
    add_xy_position(x = "dose", dodge = 0.8)
bxp + stat_pvalue_manual(
    stat.test,  label = "p", tip.length = 0
)

#pvalue disappear
ggplotly(bxp + stat_pvalue_manual(
+     stat.test,  label = "p", tip.length = 0
+ ))

Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomBracket() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the geom2trace.default warning shown in the example and inspect how ggplotly handles the supplied geom_GeomBracket(). Reproduce the ToothGrowth example, then verify that the bracket and p-values appear in the interactive plot without the unimplemented-geom warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.