def SetForEps(proport=0.75, fig_width_pt=455.24, xylabel_fs=9, leg_fs=8, text_fs=9, xtick_fs=7, ytick_fs=7, text_usetex=True, mplclose=True): """ Set figure proportions ====================== """ # fig_width_pt = 455.24411 # Get this from LaTeX using \showthe\columnwidth inches_per_pt = 1.0 / 72.27 # Convert pt to inch fig_width = fig_width_pt * inches_per_pt # width in inches fig_height = fig_width * proport # height in inches fig_size = [fig_width, fig_height] #params = {'mathtext.fontset':'stix', # 'cm', 'stix', 'stixsans', 'custom' params = { 'backend': 'ps', 'axes.labelsize': xylabel_fs, 'font.size': text_fs, 'legend.fontsize': leg_fs, 'xtick.labelsize': xtick_fs, 'ytick.labelsize': ytick_fs, 'text.usetex': text_usetex, # very IMPORTANT to avoid Type 3 fonts 'ps.useafm': True, # very IMPORTANT to avoid Type 3 fonts 'pdf.use14corefonts': True, # very IMPORTANT to avoid Type 3 fonts 'figure.figsize': fig_size, } if mplclose: MPLclose() rcdefaults() rcParams.update(params)
def SetForPng(proport=0.75, fig_width_pt=455.24, dpi=150, xylabel_fs=9, leg_fs=8, text_fs=9, xtick_fs=7, ytick_fs=7): """ Set figure proportions ====================== """ inches_per_pt = 1.0 / 72.27 # Convert pt to inch fig_width = fig_width_pt * inches_per_pt # width in inches fig_height = fig_width * proport # height in inches fig_size = [fig_width, fig_height] params = { 'axes.labelsize': xylabel_fs, 'font.size': text_fs, 'legend.fontsize': leg_fs, 'xtick.labelsize': xtick_fs, 'ytick.labelsize': ytick_fs, 'figure.figsize': fig_size, 'savefig.dpi': dpi, } #utl.Ff(&bb, "SetFontSize(%s)\n", args) #utl.Ff(&bb, "rcParams.update({'savefig.dpi':%d})\n", dpi) MPLclose() rcdefaults() rcParams.update(params)