@@ -1243,30 +1243,38 @@ def _get_marker_t_color(distribution):
1243
1243
1244
1244
return fmt
1245
1245
1246
- def _get_marker_w_color (distribution ):
1246
+ def _get_marker_w_color (distribution , percentile ):
1247
1247
"""Returns matplotlib marker style as fmt string"""
1248
1248
1249
- if distribution < 0.05 :
1249
+ if distribution < ( 1 - percentile / 100 ) :
1250
1250
fmt = True
1251
1251
else :
1252
1252
fmt = False
1253
1253
1254
1254
return fmt
1255
1255
1256
- def plot_comparison_test (results_t , results_w = None , plot_args = None ):
1256
+ def plot_comparison_test (results_t , results_w = None , axes = None , plot_args = None ):
1257
1257
"""Plots list of T-Test (and W-Test) Results"""
1258
1258
1259
1259
if plot_args is None :
1260
1260
plot_args = {}
1261
+
1262
+ figsize = plot_args .get ('figsize' , None )
1261
1263
title = plot_args .get ('title' , 'CSEP1 Comparison Test' )
1262
1264
xlabel = plot_args .get ('xlabel' , 'X' )
1263
1265
ylabel = plot_args .get ('ylabel' , 'Y' )
1264
1266
ylims = plot_args .get ('ylims' , (None , None ))
1265
1267
capsize = plot_args .get ('capsize' , 2 )
1266
1268
linewidth = plot_args .get ('linewidth' , 1 )
1267
1269
markersize = plot_args .get ('markersize' , 2 )
1270
+ percentile = plot_args .get ('percentile' , 95 )
1271
+
1272
+ if axes is None :
1273
+ fig , ax = pyplot .subplots (figsize = figsize )
1274
+ else :
1275
+ ax = axes
1276
+ fig = ax .get_figure ()
1268
1277
1269
- fig , ax = pyplot .subplots ()
1270
1278
ax .axhline (y = 0 , linestyle = '--' , color = 'black' )
1271
1279
1272
1280
Results = zip (results_t , results_w ) if results_w else zip (results_t )
@@ -1284,7 +1292,7 @@ def plot_comparison_test(results_t, results_w=None, plot_args=None):
1284
1292
linewidth = linewidth , capsize = capsize )
1285
1293
1286
1294
if result_w is not None :
1287
- if _get_marker_w_color (result_w .quantile ):
1295
+ if _get_marker_w_color (result_w .quantile , percentile ):
1288
1296
facecolor = _get_marker_t_color (result_t .test_distribution )
1289
1297
else :
1290
1298
facecolor = 'white'
0 commit comments