@@ -1034,6 +1034,7 @@ def plot_block_correlation(
10341034 assemblers = settings ["labels" ]["assemblers" ]
10351035 # 'Mann-Whitney', 't-test_ind', 'Wilcoxon'
10361036
1037+ block_colors = {"recovered" : "lightgreen" , "missed" : "#dddddd" }
10371038 for i , environment in tqdm (enumerate (environments ), disable = not verbose , desc = f"Drawing panels for { field } plot" ):
10381039 ax = axes [i ]
10391040 plotdata = data_block_recovery [environment ]
@@ -1050,7 +1051,7 @@ def plot_block_correlation(
10501051 x = field ,
10511052 hue = "category" ,
10521053 ax = ax ,
1053- palette = { "recovered" : "lightgreen" , "missed" : "#dddddd" } ,
1054+ palette = block_colors ,
10541055 showfliers = False ,
10551056 hue_order = hue_order ,
10561057 order = ordered_assembler ,
@@ -1080,6 +1081,19 @@ def plot_block_correlation(
10801081 fontweight = "bold" ,
10811082 )
10821083
1084+ ns = plotdata .groupby (["assembler" , "category" ]).size ()
1085+ ax_ns = ax .twinx ()
1086+ ax_ns .set_ylim (ax .get_ylim ())
1087+ ns_labels = []
1088+ ns_colors = []
1089+ for ass_label in ordered_assembler :
1090+ for cat in hue_order :
1091+ ns_labels .append (f"n={ ns .loc [ass_label , cat ]:,} " )
1092+ ns_colors .append ({"lightgreen" : "darkgreen" , "#dddddd" : "darkgray" }.get (block_colors [cat ]))
1093+ ax_ns .set_yticks ([x + offset for x in ax .get_yticks () for offset in [- 0.2 , 0.2 ]], labels = ns_labels , fontsize = 8 )
1094+ for color , label in zip (ns_colors , ax_ns .get_yticklabels ()):
1095+ label .set_color (color )
1096+
10831097 if test is not None :
10841098 annotator = Annotator (
10851099 ax ,
@@ -1128,6 +1142,7 @@ def plot_block_correlation(
11281142 [0 , 100 , 200 , 300 , 400 , 500 , 1000 , 2000 , 3000 ],
11291143 labels = ["0" , "" , "" , "" , "" , "500" , "1000" , "2000" , "3000" ],
11301144 )
1145+
11311146 return fig
11321147
11331148
0 commit comments