if isinstance(text_box_options_list, list):
     for text_box_options in text_box_options_list:
         args=text_box_options.get('args')
         kwargs={'verticalalignment':'top','transform':axes.transAxes,
                 'fontsize':20,'horizontalalignment':'left'}
         kwargs.update(text_box_options.get('kwargs',{}))
         axes.text(*args,**kwargs)
 #FIXME: there might be a better way of zipping an unzipping
 filenames, plotnames, layers_options, layers_zaxis = layers_details
 for filename, plotname, layer_options, layer_zaxis in zip(filenames, plotnames, layers_options, layers_zaxis):
     plot=cw.get_2d_hist(filename,plotname,nxbins,nybins)
     entries_plotname='{}_entries'.format('_'.join([axis['name'] for axis in axes_details]))
     entries_plot=cw.get_2d_hist(filename,entries_plotname,nxbins,nybins)
     chi2_plotname='{}_chi2'.format('_'.join([axis['name'] for axis in axes_details]))
     chi2_plot=cw.get_2d_hist(filename,chi2_plotname,nxbins,nybins)
     if layer_options.get('colz',False):
         #mask where rowid == -1 (not filled)
         plot=ma.masked_where(entries_plot==-1,plot)
         if layer_options.get('mask_dchi2_gt'):
             dchi2_max=layer_options.get('mask_dchi2_gt')
             chi2_minimum=cw.get_min_reference(filename)
             if chi2_minimum==1e9:
                 chi2_minimum=layer_options.get('chi2_minimum',numpy.min(chi2_plot))
             plot=ma.masked_where(chi2_plot>chi2_minimum+dchi2_max,plot)
         if layer_options.get('dchi2_mode',False):
             chi2_minimum=cw.get_min_reference(filename)
             if chi2_minimum==1e9:
                 chi2_minimum=layer_options.get('chi2_minimum',numpy.min(plot))
             plot=plot-chi2_minimum
         #get options
         vmin=layer_options.get('vmin')
         axes.set_xticks(numpy.arange(low,high*1.001,step))
 text_box_options_list = figure_options.get('text_boxes',False)
 if isinstance(text_box_options_list, list):
     for text_box_options in text_box_options_list:
         args=text_box_options.get('args')
         kwargs={'verticalalignment':'top','transform':axes.transAxes,
                 'fontsize':20,'horizontalalignment':'left'}
         kwargs.update(text_box_options.get('kwargs',{}))
         axes.text(*args,**kwargs)
 #FIXME: there might be a better way of zipping an unzipping
 filenames, plotnames, layers_options = layers_details
 for filename, plotname, layer_options in zip(filenames, plotnames, layers_options):
     plot=cw.get_1d_hist(filename,plotname,nxbins)
     entries_plotname='{}_entries'.format(xaxis_details['name'])
     entries_plot=cw.get_1d_hist(filename,entries_plotname,nxbins)
     if layer_options.get('dchi2_mode',False):
         #chi2_minimum=cw.get_min_reference(filename)
         chi2_minimum = cw.get_1d_minimum(filename,plotname,nxbins)
         if chi2_minimum==1e9:
             chi2_minimum=layer_options.get('chi2_minimum',numpy.min(plot))
         plot=plot-chi2_minimum
     color=layer_options.get('color')
     linestyle=layer_options.get('linestyle')
     linewidth=layer_options.get('linewidth',2)
     label = layer_options.get('label')
     axes.plot(bin_centres,plot,linewidth=linewidth,c=color,
             linestyle=linestyle)
     #FIXME: maybe ylim shouldn't be a property of the layer
     axes.set_ylim([layer_options.get('ymin',0),layer_options.get('ymax',9)])
     axes.set_ylabel(layer_options.get('ylabel',''),fontsize=20)
     #FIXME: this is an ugly way to get the 95% CL lower limit out