def make_category_scatter_figure():
    categories = get_data()

    # Build a figure and place a single axes instance in it.
    fig = plt.figure(figsize=(4,3))
    ax1 = fig.add_subplot(1,1,1)

    # Use our helper function to do the category scatter plot.
    cs = CategoryScatter( ax1, categories )

    # Locate the axes spines on the left and bottom.
    spine_placer(ax1, location='left,bottom' )

    # Finalize the category scatter plot (stuff that can only be done
    # after the spines are placed).
    cs.finalize()

    # Add standard y label.
    ax1.set_ylabel('y value (units)')

    # Now, add a final few touchups.
    ax1.spines['bottom'].set_color('none') # don't draw bottom spine
    ax1.yaxis.set_major_locator( mticker.MaxNLocator(nbins=4) )
    auto_reduce_spine_bounds( ax1 )

    fig.tight_layout()
    return fig
def make_many_timeseries_figure():
    # Generate some fake data in 4 timeseries
    times = np.arange( 0, 200.0, 0.01 )
    nt = len(times)
    ys = []
    for i in range(4):
        ys.append( np.sin( times*2*np.pi*0.02 + i*20 ) + 0.13*np.random.randn(nt) )

    # Build a figure and place a two axes instances in it.
    fig = plt.figure(figsize=(8,6))
    ax1 = fig.add_subplot(2,1,1)
    ax2 = fig.add_subplot(2,1,2)

    # Use our helper function to plot the multiple timeseries.
    mts1 = ManyTimeseries( ax1, times, ys, show=['all','mean'] )

    # Use our helper function to plot the multiple timeseries.
    mts2 = ManyTimeseries( ax2, times, ys, show=['mean','std'] )

    # Locate the axes spines.
    spine_placer(ax1, location='left' )
    spine_placer(ax2, location='left,bottom' )

    # Finalize the plots (stuff that can only be done
    # after the spines are placed).
    mts1.finalize()
    mts2.finalize()

    # Add standard axis labels.
    ax1.set_ylabel('y1 value (units)')
    ax2.set_ylabel('y2 value (units)')
    ax2.set_xlabel('time (seconds)')

    # Now, add a final few touchups.
    ax1.yaxis.set_major_locator( mticker.MaxNLocator(nbins=4) )
    ax1.set_xticks([])
    ax2.yaxis.set_major_locator( mticker.MaxNLocator(nbins=4) )
    auto_reduce_spine_bounds( ax1 )
    auto_reduce_spine_bounds( ax2 )

    fig.tight_layout()
    return fig