Getting weird plot with ggpubr package I have a data frame for two groups and 9 variables 

&gt; head(aa)
  treatment variable     value
1       pre     Sig1 0.1173863
2       pre     Sig1 0.1888243
3       pre     Sig1 0.2191765
4       pre     Sig1 0.1277735
5       pre     Sig1 0.1711712
6       pre     Sig1 0.0000000
&gt; class(aa)
[1] "data.frame"
&gt; str(aa)
'data.frame':   1026 obs. of  3 variables:
 $ treatment: Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
 $ variable : Factor w/ 9 levels "Sig1","Sig2",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ value    : num  0.117 0.189 0.219 0.128 0.171 ...
&gt; tail(aa)
     treatment variable value
1021      post     Sig9     0
1022      post     Sig9     0
1023      post     Sig9     0
1024      post     Sig9     0
1025      post     Sig9     0
1026      post     Sig9     0
&gt;


I am using this code

library(ggpubr)
&gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
&gt; my_comparisons &lt;- c("pre","post")
&gt; p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y = 50)  
Warning message:
Computation failed in `stat_signif()`:
missing value where TRUE/FALSE needed 
&gt; 


But I am getting this weird plot



While something like this is my goal



I really don't know where I am doing wrong

I used ggplot where I got something like this but I need statistics that is why I have stuck on this 



I then used this code 

&gt; DF &lt;- aa %&gt;% pivot_longer(.,cols = c(Sig1,Sig2,Sig3, Sig4,Sig5,Sig6,Sig7,Sig8,Sig9), names_to = "var", values_to = "val")
&gt; View(DF)
&gt; library(ggplot2)
&gt; library(ggpubr)
&gt; ggplot(DF, aes(x = treatment, y = val, fill = treatment))+
+     geom_boxplot()+
+     stat_compare_means(comparisons = c("pre","post")+
+     stat_compare_means()+
+     facet_grid(var~., scales = "free")
+ 


But I got another weird plot



But changing the scale I got this but gives one statistics



While I need one stat for each variable between pre and post groups

This solution gives to statistics

&gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment",facet.by = "variable")
&gt; p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y =2)




When I edited my code

&gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
&gt; p + stat_compare_means(aes(group = variable))
&gt; 


But again one stat
The problem is the scale used: For the plot you called "weird" (first from the top), the scale is 50 and for the "ggplot only" (third from the top) the scale is 1.

You should play with the stat_compare_means(label.y = 50) bit, you can try setting the label.y parameter to 1.5 or 2.

EDIT BECAUSE OF THE ADDITIONAL REMARKS ON THE QUESTION:

Once again (and for sure the last time), I had to manually create example data as OP ignores repeated reminders on how to make a reproducible example with R.

library(data.table)
library(ggpubr)

text &lt;- "
treatment variable     value
1       pre     Sig1 0.1173863
2       pre     Sig1 0.1888243
3       pre     Sig1 0.2191765
4       pre     Sig1 0.1277735
5       pre     Sig1 0.1711712
6       pre     Sig1 0.0000000
1       post     Sig1 0.1173863
2       post     Sig1 0.1888243
3       post     Sig1 0.2191765
4       post     Sig1 0.1277735
5       post     Sig1 0.1711712
6       post     Sig1 0.0000000
1021      pre     Sig9     0
1022      pre     Sig9     0
1023      pre     Sig9     0
1024      pre     Sig9     0
1025      pre     Sig9     0
1026      pre     Sig9     0
1021      post     Sig9     1
1022      post     Sig9     1
1023      post     Sig9     1
1024      post     Sig9     1
1025      post     Sig9     1
1026      post     Sig9     1
"
my_data &lt;-fread(text)

&gt; my_data
      V1 treatment variable     value
 1:    1       pre     Sig1 0.1173863
 2:    2       pre     Sig1 0.1888243
 3:    3       pre     Sig1 0.2191765
 4:    4       pre     Sig1 0.1277735
 5:    5       pre     Sig1 0.1711712
 6:    6       pre     Sig1 0.0000000
 7:    1      post     Sig1 0.1173863
 8:    2      post     Sig1 0.1888243
 9:    3      post     Sig1 0.2191765
10:    4      post     Sig1 0.1277735
11:    5      post     Sig1 0.1711712
12:    6      post     Sig1 0.0000000
13: 1021       pre     Sig9 0.0000000
14: 1022       pre     Sig9 0.0000000
15: 1023       pre     Sig9 0.0000000
16: 1024       pre     Sig9 0.0000000
17: 1025       pre     Sig9 0.0000000
18: 1026       pre     Sig9 0.0000000
19: 1021      post     Sig9 1.0000000
20: 1022      post     Sig9 1.0000000
21: 1023      post     Sig9 1.0000000
22: 1024      post     Sig9 1.0000000
23: 1025      post     Sig9 1.0000000
24: 1026      post     Sig9 1.0000000
      V1 treatment variable     value

ggboxplot(my_data,
          x = "treatment",
          y = "value",
          color = "treatment",
          facet.by = "variable") + 
  stat_compare_means(label = "p.format")


And this code generates: