import matplotlib.pyplot as plt

def figaxes(subplots=(1,1), subplot_kw=None, **fig_kw):
    """Create a figure with a set of subplots already made.

    This utility wrapper makes it convenient to create common layouts of
    subplots, including the enclosing figure object, in a single call.

    Parameters
    ----------
    subplots : 2-tuple, optional
      Number of rows and columns of the subplot grid.  Defaults to (1,1).

    subplot_kw : dict, optional
      Dict with keywords passed to the add_subplot() call used to create each
      subplots.

    fig_kw : dict, optional
      Dict with keywords passed to the figure() call.

    Returns
    -------
    fig : object
      Matplotlib Figure object.
      
    axes : list
      List of axes
    """
    if subplot_kw is None:
        subplot_kw = {}
        
    fig = plt.figure(**fig_kw)
    nrows, ncols = subplots
    axes = [ fig.add_subplot(nrows, ncols, i, **subplot_kw)
             for i in range(1, nrows*ncols+1) ]
    return fig, axes
