@@ -386,7 +386,7 @@ def returnParamsFromResults(final_params, param_names=None):
386
386
387
387
def plotFitCurve (concentrations , subSeries , results ,
388
388
fitParameters , log_axis = None , func = None , use_default = None ,
389
- fittype = None , errors = None , default_errors = None ):
389
+ fittype = None , errors = None , default_errors = None , ax = None ):
390
390
# default is to log axis
391
391
if log_axis is None :
392
392
log_axis = True
@@ -427,14 +427,15 @@ def plotFitCurve(concentrations, subSeries, results,
427
427
eminus = eplus = default_errors / np .sqrt (numTests )
428
428
429
429
# plot binding points
430
- plt .figure (figsize = (2.5 ,2.3 ));
431
- plt .errorbar (concentrations , fluorescence ,
430
+ if ax is None :
431
+ fig = plt .figure (figsize = (2.5 ,2.3 ));
432
+ ax = fig .add_subplot (111 )
433
+ ax .errorbar (concentrations , fluorescence ,
432
434
yerr = [eminus , eplus ], fmt = '.' , elinewidth = 1 ,
433
435
capsize = 2 , capthick = 1 , color = 'k' , linewidth = 1 )
434
436
435
437
# plot fit
436
438
if log_axis :
437
- ax = plt .gca ()
438
439
ax .set_xscale ('log' )
439
440
more_concentrations = np .logspace (np .log10 (concentrations .min ()/ 2 ),
440
441
np .log10 (concentrations .max ()* 2 ),
@@ -445,7 +446,7 @@ def plotFitCurve(concentrations, subSeries, results,
445
446
param_names = fitParameters .columns .tolist ()
446
447
params = returnParamsFromResults (results , param_names )
447
448
fit = func (params , more_concentrations )
448
- plt .plot (more_concentrations , fit , 'r' )
449
+ ax .plot (more_concentrations , fit , 'r' )
449
450
450
451
try :
451
452
# find upper bound
@@ -479,7 +480,7 @@ def plotFitCurve(concentrations, subSeries, results,
479
480
label = '95% conf int' , alpha = 0.5 )
480
481
except :
481
482
pass
482
- ax = plt . gca ()
483
+
483
484
ax .tick_params (right = 'off' , top = 'off' )
484
485
ax .tick_params (which = "minor" , right = 'off' , top = 'off' )
485
486
ylim = ax .get_ylim ()
0 commit comments