@@ -494,7 +494,7 @@ def plot_one_group_violin_figure(
494494 statistic : bool = False ,
495495 test_method : list [str ] = ["ttest_ind" ],
496496 popmean : Num = 0 ,
497- p_list : list [float ] | None = None ,
497+ p_list : list [int | float ] | None = None ,
498498 statistical_line_color : str = "0.5" ,
499499 asterisk_fontsize : Num = 10 ,
500500 asterisk_color : str = "k" ,
@@ -664,6 +664,7 @@ def _draw_gradient_violin(ax, data, pos, width, c1, c2, color_alpha):
664664 q1 = np .percentile (data , 25 )
665665 q3 = np .percentile (data , 75 )
666666 median = np .median (data )
667+ mean = np .mean (data )
667668 # 添加 IQR box(黑色矩形)
668669 ax .add_patch (
669670 Rectangle (
@@ -674,8 +675,25 @@ def _draw_gradient_violin(ax, data, pos, width, c1, c2, color_alpha):
674675 alpha = 0.7 ,
675676 )
676677 )
677- # 添加白色中位数点
678- ax .plot (pos , median , "o" , color = "white" , markersize = 5 , zorder = 3 )
678+ # 添加白色均值点
679+ ax .plot (
680+ pos ,
681+ mean ,
682+ "o" ,
683+ color = "white" ,
684+ markersize = 5 ,
685+ markeredgecolor = "black" ,
686+ markeredgewidth = 1 ,
687+ zorder = 3 ,
688+ )
689+ # 添加白色中位数线
690+ ax .plot (
691+ [pos - width / 16 , pos + width / 16 ],
692+ [median , median ],
693+ color = "white" ,
694+ linewidth = 2 ,
695+ zorder = 3 ,
696+ )
679697 return ymax , ymin
680698
681699 ymax_lst , ymin_lst = [], []
0 commit comments