def figure_kwargs(ftype=None, subplot=(None,None), ss=None,
    legendscale=None):
    """Given ftype=None, 'landscape', 'square', or 'portrait',
    return a dictionary containing
    figsize for the figure, called 'figsize',
    fontsize for title, legend, label, and ticks,
    called 'titlesize', 'legendsize', 'labelsize', and 'ticksize',
    and the parameters for pyplot function subplots_adjust,
    which are in their own dictionary called 'subplots_adjust',
    composed of
    'left', 'bottom', 'right', 'top', 'wspace', and 'hspace'.
    Tuple keyword subplot is the number (Nhigh,Nwide) of subplots 
    for which the adjustments are made,
    in the height and width directions.
    Keyword ss is whether axes labels have sub/superscripts,
    in which case all fontsizes would need to be scaled up -- not used.
    Keyword legendscale is whether the legend
    should be scaled up like the title
    -- not(True) means like the labels.
    """
    if subplot == (None,None): subplot=1,1 #Nhigh,Nwide
    if ftype is None:
        figsize=None    #default is 8,6
        titlesize=None  #default is 'large' (=14.5 pt)
        legendsize=None  #default is 'large' (=14.5 pt)
        labelsize=None  #default is 'medium' (=12 pt)
        ticksize=None  #default is 'medium' (=12 pt)
        subplots_adjust={
            #defaults
            'left':0.12, 'bottom':0.1, 'right':0.9,
            'top':0.9, 'wspace':0.2, 'hspace':0.2}
#            'left':None, 'bottom':None, 'right':None,
#            'top':None, 'wspace':None, 'hspace':None}
    else:
        #For 8" wide figures scaled to 3.25" (maximum PoP width, e.g.),
        #fontsize of 20 pt gives a scaled fontsize >= 8 pt,
        #but fontsize of 29 pt is the least such that sub/superscripts
        #also give scaled fontsize >= 8 pt.
        #This code does not allow for sub/superscripts,
        #and simply uses titlesize
        #scaled to 24 to keep about the same proportions
        #to labelsize and ticksize as in the default case,
        #and uses legendsize
        #scaled relatively down compared to the default case
        #to keep the legend small compared to the plotted data.
        #Note mathtext (used with values like r'$latex$')
        #does not seem to look as big as the fontsize value,
        #so avoid using mathtext.
        
        titlesize=24
        if legendscale: legendsize=24
        else: legendsize=20
        labelsize=20
        ticksize=20
        if ftype == 'landscape': figsize=8,6
#            #good values for landscape
#            subplots_adjust={
#                'left': 0.12, 'bottom': 0.12, 'right':0.94,
#                'top':0.92, 'wspace':0.45, 'hspace':0.65}
        elif ftype == 'square': figsize=8,8
        elif ftype == 'portrait': figsize=8,10.6666
        else: figsize=8,8
        Width=figsize[0]    #actual sizes in inches
        Height=figsize[1]
        #Original values
#        Dwidth=1.205    #actual width in inches needed for fontsizes
#        Dheight=1.177    #actual height in inches needed for fontsizes
        #Convenient values
        D=1.125
        Dwidth=D    #actual width in inches needed for fontsizes
        Dheight=D   #actual height in inches needed for fontsizes
        #These next two fractions of whole page
        #don't change for width always = 8".
        left=0.12
        right=0.96
        #These next two fractions of whole page
        #must get bigger (i.e. further from 0 or 1, respectively)
        #as the height of page decreases, and vice versa;
        #i.e. they vary inversely.
        bottom=0.12*6./Height
        top=1.-0.08*6./Height
        #These next two fractions of a single subplot size
        #vary in a complicated way with the other parameters
        #to keep a constant actual spacing available for text.
        Nhigh=subplot[0]
        Nwide=subplot[1]
        wspace=Dwidth*Nwide/(Width*(right-left)-Dwidth*(Nwide-1))
        hspace=Dheight*Nhigh/(Height*(top-bottom)-Dheight*(Nhigh-1))
        subplots_adjust={
            'left':left, 'bottom':bottom, 'right':right,
            'top':top, 'wspace':wspace, 'hspace':hspace}
    return {
        'figsize':figsize, 'titlesize':titlesize,
        'legendsize':legendsize, 'labelsize':labelsize,
        'ticksize':ticksize, 'subplots_adjust':subplots_adjust}