Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anticipate ggplotly use and don't style text #8

Closed
jonocarroll opened this issue Aug 13, 2020 · 2 comments
Closed

Anticipate ggplotly use and don't style text #8

jonocarroll opened this issue Aug 13, 2020 · 2 comments

Comments

@jonocarroll
Copy link

Thanks for this package! I use {plotly} often using ggplotly(p) and was disappointed when {ggsignif} was unable to convert. Thankfully, {ggpval} has no such issue, however the styling of the text (italic 'P') does not carry over.

ggpval

I appreciate that this isn't any fault of {ggpval} but in anticipation of this use case, how about an optional argument to disable styling of the text, so that it goes through ggplotly() verbatim?

example code:
# R.version.string
# [1] "R version 3.6.1 (2019-07-05)"
# packageVersion("ggpval")
# [1] ‘0.2.3’

library(ggplot2)
plt <- ggplot(mtcars, aes(factor(gear), mpg)) +
  geom_boxplot() + 
  geom_jitter()
p <- ggpval::add_pval(plt, pairs = list(c(1, 2)), test = "t.test")
plotly::ggplotly(p) 
@s6juncheng
Copy link
Owner

s6juncheng commented Aug 24, 2020

Hi @jonocarroll thanks for using the package, sorry for the delayed reply.

Since ggplotly is wrapping the text differently, I added an option specifically for that. The repo is updated, one can install this dev version with devtools::install_github("s6juncheng/ggpval"). The CRAN package will be updated in the next few days. After the installation, you can simply give the plotly=TRUE option, the text style will also be rendered:

library(ggplot2)
plt <- ggplot(mtcars, aes(factor(gear), mpg)) +
  geom_boxplot() + 
  geom_jitter()
p <- ggpval::add_pval(plt, pairs = list(c(1, 2)), test = "t.test", plotly=TRUE)
plotly::ggplotly(p) 

@jonocarroll
Copy link
Author

Nice! Confirmed as working. Many thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants