# markers listmarkers=[mforminMS.filled_markersifm!='.']ifnngt._config["color_lib"]=="seaborn":try:importseabornassnswith_seaborn=Truesns.set_style("whitegrid")defsns_palette(c):ifisinstance(c,float):pal=sns.color_palette(nngt._config["palette"],100)returnpal[int(c*100)]else:returnsns.color_palette(nngt._config["palette"],len(c))palette_continuous=sns_paletteexceptImportErrorase:_log_message(logger,"WARNING","`seaborn` requested but could not set it: {}.".format(e))ifnotwith_seaborn:try:mpl.rcParams['font.size']=12mpl.rcParams['font.family']='serif'ifnngt._config['use_tex']:mpl.rc('text',usetex=True)mpl.rcParams['axes.labelsize']=mpl.rcParams['font.size']mpl.rcParams['axes.titlesize']=1.2*mpl.rcParams['font.size']mpl.rcParams['legend.fontsize']=mpl.rcParams['font.size']mpl.rcParams['xtick.labelsize']=mpl.rcParams['font.size']mpl.rcParams['ytick.labelsize']=mpl.rcParams['font.size']mpl.rcParams['savefig.dpi']=300mpl.rcParams['savefig.format']='pdf'mpl.rcParams['xtick.major.size']=3mpl.rcParams['xtick.minor.size']=3mpl.rcParams['xtick.major.width']=1mpl.rcParams['xtick.minor.width']=1mpl.rcParams['ytick.major.size']=3mpl.rcParams['ytick.minor.size']=3mpl.rcParams['ytick.major.width']=1mpl.rcParams['ytick.minor.width']=1mpl.rcParams['legend.frameon']=Falsempl.rcParams['legend.numpoints']=1mpl.rcParams['axes.linewidth']=1mpl.rcParams['axes.grid']=Truempl.rcParams['grid.linestyle']=':'mpl.rcParams['path.simplify']=TrueexceptExceptionase:_log_message(logger,"WARNING","Error configuring `matplotlib`: {}.".format(e))defformat_exponent(ax,axis='y',pos=(1.,0.),valign="top",halign="right"):importmatplotlib.pyplotasplt# Change the ticklabel format to scientific formatax.ticklabel_format(axis=axis,style='sci',scilimits=(-3,2))# Get the appropriate axisifaxis=='y':ax_axis=ax.yaxiselse:ax_axis=ax.xaxis# Run plt.tight_layout() because otherwise the offset text doesn't updateplt.tight_layout()##### THIS IS A BUG##### Well, at least it's sub-optimal because you might not##### want to use tight_layout(). If anyone has a better way of##### ensuring the offset text is updated appropriately##### please comment!# Get the offset valueoffset=ax_axis.get_offset_text().get_text()iflen(offset)>0:# Get that exponent value and change it into latex formatminus_sign=u'\u2212'expo=float(offset.replace(minus_sign,'-').split('e')[-1])offset_text=r'x$\mathregular{10^{%d}}$'%expo# Turn off the offset text that's calculated automaticallyax_axis.offsetText.set_visible(False)ax.text(pos[0],pos[1],offset_text,transform=ax.transAxes,horizontalalignment=halign,verticalalignment=valign)returnax