def x_frame2D(X,plot_limits=None,resolution=None):
assert X.shape[<NUM_LIT:1>]==<NUM_LIT:2>, "<STR_LIT>"<EOL>if plot_limits is None:<EOL><INDENT>xmin, xmax = X.min(<NUM_LIT:0>), X.max(<NUM_LIT:0>)<EOL>xmin, xmax = xmin-<NUM_LIT>*(xmax-xmin), xmax+<NUM_LIT>*(xmax-xmin)<EOL><DEDENT>elif len(plot_limits) == <NUM_LIT:2>:<EOL><INDENT>xmin, xmax = plot_limits<EOL>try:<EOL><INDENT>xmin = xmin[<NUM_LIT:0>], xmin[<NUM_LIT:1>]<EOL><DEDENT>except:<EOL><INDENT>xmin = [plot_limits[<NUM_LIT:0>], plot_limits[<NUM_LIT:0>]]<EOL>xmax = [plot_limits[<NUM_LIT:1>], plot_limits[<NUM_LIT:1>]]<EOL><DEDENT><DEDENT>elif len(plot_limits) == <NUM_LIT:4>:<EOL><INDENT>xmin, xmax = (plot_limits[<NUM_LIT:0>], plot_limits[<NUM_LIT:2>]), (plot_limits[<NUM_LIT:1>], plot_limits[<NUM_LIT:3>])<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>resolution = resolution or <NUM_LIT:50><EOL>xx, yy = np.mgrid[xmin[<NUM_LIT:0>]:xmax[<NUM_LIT:0>]:<NUM_LIT>*resolution,xmin[<NUM_LIT:1>]:xmax[<NUM_LIT:1>]:<NUM_LIT>*resolution]<EOL>Xnew = np.c_[xx.flat, yy.flat]<EOL>return Xnew, xx, yy, xmin, xmax<EOL>
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits