@@ -764,7 +764,8 @@ def size_map(markersize, values, scale):
764
764
pts = catalog .region .tight_bbox ()
765
765
ax .plot (pts [:, 0 ], pts [:, 1 ], lw = 1 , color = 'black' )
766
766
except AttributeError :
767
- print ("unable to get tight bbox" )
767
+ pass
768
+ # print("unable to get tight bbox")
768
769
769
770
# Gridline options
770
771
if grid :
@@ -1295,7 +1296,7 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
1295
1296
title = plot_args .get ('title' , 'CSEP1 Comparison Test' )
1296
1297
xlabel = plot_args .get ('xlabel' , 'X' )
1297
1298
ylabel = plot_args .get ('ylabel' , 'Y' )
1298
- ylims = plot_args .get ('ylims ' , (None , None ))
1299
+ ylim = plot_args .get ('ylim ' , (None , None ))
1299
1300
capsize = plot_args .get ('capsize' , 2 )
1300
1301
linewidth = plot_args .get ('linewidth' , 1 )
1301
1302
markersize = plot_args .get ('markersize' , 2 )
@@ -1330,7 +1331,6 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
1330
1331
facecolor = 'white'
1331
1332
else :
1332
1333
facecolor = 'white'
1333
-
1334
1334
ax .plot (index , result_t .observed_statistic , marker = 'o' , markerfacecolor = facecolor , markeredgecolor = color , markersize = markersize )
1335
1335
1336
1336
ax .set_xticklabels ([res .sim_name [0 ] for res in results_t ], rotation = 90 )
@@ -1339,18 +1339,17 @@ def plot_comparison_test(results_t, results_w=None, axes=None, plot_args=None):
1339
1339
ax .set_ylabel (ylabel )
1340
1340
ax .set_title (title )
1341
1341
ax .yaxis .grid ()
1342
- xTickPos , _ = pyplot . xticks ()
1342
+ xTickPos = ax . get_xticks ()
1343
1343
ax .yaxis .set_major_locator (matplotlib .ticker .MaxNLocator (integer = True ))
1344
- ax .set_ylim ([ylims [0 ], ylims [1 ]])
1345
- ax .set_xlim ([ax . get_xlim ()[ 0 ] + 0 .5 , ax . get_xlim ()[ 1 ] - 0.5 ])
1344
+ ax .set_ylim ([ylim [0 ], ylim [1 ]])
1345
+ ax .set_xlim ([- 0 .5 , len ( results_t ) - 0.5 ])
1346
1346
ax .bar (xTickPos , numpy .array ([9999 ] * len (xTickPos )), bottom = - 2000 ,
1347
1347
width = (xTickPos [1 ] - xTickPos [0 ]), color = ['gray' , 'w' ], alpha = 0.2 )
1348
1348
fig .tight_layout ()
1349
1349
1350
1350
return ax
1351
1351
1352
-
1353
- def plot_poisson_consistency_test (eval_results , normalize = False , one_sided_lower = False , plot_args = None ):
1352
+ def plot_poisson_consistency_test (eval_results , normalize = False , one_sided_lower = False , axes = None , plot_args = None ):
1354
1353
""" Plots results from CSEP1 tests following the CSEP1 convention.
1355
1354
1356
1355
Note: All of the evaluations should be from the same type of evaluation, otherwise the results will not be
@@ -1404,7 +1403,12 @@ def plot_poisson_consistency_test(eval_results, normalize=False, one_sided_lower
1404
1403
tight_layout = plot_args .get ('tight_layout' , True )
1405
1404
percentile = plot_args .get ('percentile' , 95 )
1406
1405
1407
- fig , ax = pyplot .subplots (figsize = figsize )
1406
+ if axes is None :
1407
+ fig , ax = pyplot .subplots (figsize = figsize )
1408
+ else :
1409
+ ax = axes
1410
+ fig = ax .get_figure ()
1411
+
1408
1412
xlims = []
1409
1413
for index , res in enumerate (results ):
1410
1414
# handle analytical distributions first, they are all in the form ['name', parameters].
0 commit comments