cannot remove "y.position" from y-axis title when using ggpubr and ggbreak together

103 Views Asked by At

not enough reputation to post images in a question, here is the plot

plot

Plot was generated by

library(ggplot2)
library(ggbreak) 
library(ggpubr)

df <- ToothGrowth

bxp <- ggboxplot(df, x= "dose", y = "len", fill = "dose")

stat.test1 <- compare_means(
  len ~ dose, data = df,
  method = "t.test"
)

stat.test1 <- stat.test1 %>%
  mutate(y.position = c(29, 35, 39))

p <- bxp + stat_pvalue_manual(stat.test1, label = "p.adj") +
  scale_y_break(c(10, 10.5), scale = 2) 

p

I would like to add p-value with ggpubr onto a plot created with ggbreak, but when using both, the "y.position" appears and I cannot remove them. do need to break the plot into sections and scale them using ggbreak, and I do need a y-axis title Any help will be greatly appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

You can simply do:

p$labels$y.position <- NULL

p

enter image description here