def ubertidy(figure="<STR_LIT>", zoom=True, width=None, height=None, font_name='<STR_LIT>', font_size=<NUM_LIT:12>, font_weight='<STR_LIT>',<EOL>border_width=<NUM_LIT>, tick_width=<NUM_LIT:1>, ticks_point="<STR_LIT>", xlabel_pad=<NUM_LIT>, ylabel_pad=<NUM_LIT>, window_size=[<NUM_LIT>,<NUM_LIT>],<EOL>keep_axis_labels=False, axis_label_font_size=<NUM_LIT>, axis_label_font_weight='<STR_LIT>', keep_legend=True):
if figure=="<STR_LIT>": f = _pylab.gcf()<EOL>else:             f = figure<EOL>set_figure_window_geometry(fig=f, size=window_size)<EOL>for n in range(len(f.axes)):<EOL><INDENT>a = f.axes[n]<EOL>_pylab.axes(a)<EOL>a.spines['<STR_LIT>']     .set_linewidth(border_width)<EOL>a.spines['<STR_LIT:left>']    .set_linewidth(border_width)<EOL>a.spines['<STR_LIT>']  .set_linewidth(border_width)<EOL>a.spines['<STR_LIT:right>']   .set_linewidth(border_width)<EOL>xticklines = a.get_xticklines()<EOL>yticklines = a.get_yticklines()<EOL>_pylab.setp(xticklines+yticklines, mew=tick_width)<EOL>if ticks_point=="<STR_LIT>":<EOL><INDENT>for n in range(len(xticklines)):<EOL><INDENT>if not n%<NUM_LIT:2>: xticklines[n].set_marker(_mpl.lines.TICKDOWN)<EOL>else:       xticklines[n].set_marker(_mpl.lines.TICKUP)<EOL><DEDENT>for n in range(len(yticklines)):<EOL><INDENT>if not n%<NUM_LIT:2>: yticklines[n].set_marker(_mpl.lines.TICKLEFT)<EOL>else:       yticklines[n].set_marker(_mpl.lines.TICKRIGHT)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for n in range(len(xticklines)):<EOL><INDENT>if n%<NUM_LIT:2>: xticklines[n].set_marker(_mpl.lines.TICKDOWN)<EOL>else:   xticklines[n].set_marker(_mpl.lines.TICKUP)<EOL><DEDENT>for n in range(len(yticklines)):<EOL><INDENT>if n%<NUM_LIT:2>: yticklines[n].set_marker(_mpl.lines.TICKLEFT)<EOL>else:   yticklines[n].set_marker(_mpl.lines.TICKRIGHT)<EOL><DEDENT><DEDENT>_pylab.xticks(fontsize=font_size, fontweight=font_weight, fontname=font_name)<EOL>_pylab.yticks(fontsize=font_size, fontweight=font_weight, fontname=font_name)<EOL>for label in _pylab.xticks()[<NUM_LIT:1>]: label.set_y(-xlabel_pad)<EOL>for label in _pylab.yticks()[<NUM_LIT:1>]: label.set_x(-ylabel_pad)<EOL>p = a.get_position().bounds<EOL>if width:  a.set_position([<NUM_LIT>,p[<NUM_LIT:1>],<NUM_LIT>+width*<NUM_LIT:0.5>,p[<NUM_LIT:3>]])<EOL>p = a.get_position().bounds<EOL>if height: a.set_position([p[<NUM_LIT:0>],<NUM_LIT>,p[<NUM_LIT:2>],<NUM_LIT>+height*<NUM_LIT:0.5>])<EOL>a.set_title('<STR_LIT>')<EOL>if not keep_axis_labels:<EOL><INDENT>a.set_xlabel('<STR_LIT>')<EOL>a.set_ylabel('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>_pylab.xlabel(a.get_xlabel(), fontsize=axis_label_font_size, fontweight=axis_label_font_weight, fontname=font_name)<EOL>_pylab.ylabel(a.get_ylabel(), fontsize=axis_label_font_size, fontweight=axis_label_font_weight, fontname=font_name)<EOL><DEDENT>if not keep_legend: a.legend_ = None<EOL>if zoom: auto_zoom(axes=a)<EOL><DEDENT>
This guy performs the ubertidy, which some of us use to prep a figure
for talks or papers.

figure="gcf"                    Which figure to tidy.
zoom=True                       Whether to auto-zoom on the data
width=None                      Width of the axes (relative to window)
height=None                     Height of the axes (relative to window)
font_name='Arial'               Must be installed on system
font_size=12                    Font size for all but axis labels
font_weight='normal'            Could be 'bold'
border_width=1.2                Thickness of the axes border
tick_width=1                    Thickness of ticks
ticks_point="in"                Whether ticks point "in" or "out" of axis
xtick_label_pad=0.010           Padding on x-tick labels
ytick_label_pad=0.008           Padding on y-tick labels
window_size=[550,400]           Size of window in pixels
keep_axis_labels=False          Whether to keep the axis labels
axis_label_font_size=14         Font size for axis labels
axis_label_font_weight='normal' Could be 'bold'
keep_legend=False               Whether to keep the legend