def scatter_matrix(frame, alpha=<NUM_LIT:0.5>, figsize=None, ax=None, grid=False,<EOL>diagonal='<STR_LIT>', marker='<STR_LIT:.>', density_kwds=None,<EOL>hist_kwds=None, range_padding=<NUM_LIT>, **kwds):
df = frame._get_numeric_data()<EOL>n = df.columns.size<EOL>naxes = n * n<EOL>fig, axes = _subplots(naxes=naxes, figsize=figsize, ax=ax,<EOL>squeeze=False)<EOL>fig.subplots_adjust(wspace=<NUM_LIT:0>, hspace=<NUM_LIT:0>)<EOL>mask = notna(df)<EOL>marker = _get_marker_compat(marker)<EOL>hist_kwds = hist_kwds or {}<EOL>density_kwds = density_kwds or {}<EOL>kwds.setdefault('<STR_LIT>', '<STR_LIT:none>')<EOL>boundaries_list = []<EOL>for a in df.columns:<EOL><INDENT>values = df[a].values[mask[a].values]<EOL>rmin_, rmax_ = np.min(values), np.max(values)<EOL>rdelta_ext = (rmax_ - rmin_) * range_padding / <NUM_LIT><EOL>boundaries_list.append((rmin_ - rdelta_ext, rmax_ + rdelta_ext))<EOL><DEDENT>for i, a in zip(lrange(n), df.columns):<EOL><INDENT>for j, b in zip(lrange(n), df.columns):<EOL><INDENT>ax = axes[i, j]<EOL>if i == j:<EOL><INDENT>values = df[a].values[mask[a].values]<EOL>if diagonal == '<STR_LIT>':<EOL><INDENT>ax.hist(values, **hist_kwds)<EOL><DEDENT>elif diagonal in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>from scipy.stats import gaussian_kde<EOL>y = values<EOL>gkde = gaussian_kde(y)<EOL>ind = np.linspace(y.min(), y.max(), <NUM_LIT:1000>)<EOL>ax.plot(ind, gkde.evaluate(ind), **density_kwds)<EOL><DEDENT>ax.set_xlim(boundaries_list[i])<EOL><DEDENT>else:<EOL><INDENT>common = (mask[a] & mask[b]).values<EOL>ax.scatter(df[b][common], df[a][common],<EOL>marker=marker, alpha=alpha, **kwds)<EOL>ax.set_xlim(boundaries_list[j])<EOL>ax.set_ylim(boundaries_list[i])<EOL><DEDENT>ax.set_xlabel(b)<EOL>ax.set_ylabel(a)<EOL>if j != <NUM_LIT:0>:<EOL><INDENT>ax.yaxis.set_visible(False)<EOL><DEDENT>if i != n - <NUM_LIT:1>:<EOL><INDENT>ax.xaxis.set_visible(False)<EOL><DEDENT><DEDENT><DEDENT>if len(df.columns) > <NUM_LIT:1>:<EOL><INDENT>lim1 = boundaries_list[<NUM_LIT:0>]<EOL>locs = axes[<NUM_LIT:0>][<NUM_LIT:1>].yaxis.get_majorticklocs()<EOL>locs = locs[(lim1[<NUM_LIT:0>] <= locs) & (locs <= lim1[<NUM_LIT:1>])]<EOL>adj = (locs - lim1[<NUM_LIT:0>]) / (lim1[<NUM_LIT:1>] - lim1[<NUM_LIT:0>])<EOL>lim0 = axes[<NUM_LIT:0>][<NUM_LIT:0>].get_ylim()<EOL>adj = adj * (lim0[<NUM_LIT:1>] - lim0[<NUM_LIT:0>]) + lim0[<NUM_LIT:0>]<EOL>axes[<NUM_LIT:0>][<NUM_LIT:0>].yaxis.set_ticks(adj)<EOL>if np.all(locs == locs.astype(int)):<EOL><INDENT>locs = locs.astype(int)<EOL><DEDENT>axes[<NUM_LIT:0>][<NUM_LIT:0>].yaxis.set_ticklabels(locs)<EOL><DEDENT>_set_ticks_props(axes, xlabelsize=<NUM_LIT:8>, xrot=<NUM_LIT>, ylabelsize=<NUM_LIT:8>, yrot=<NUM_LIT:0>)<EOL>return axes<EOL>
Draw a matrix of scatter plots.

Parameters
----------
frame : DataFrame
alpha : float, optional
    amount of transparency applied
figsize : (float,float), optional
    a tuple (width, height) in inches
ax : Matplotlib axis object, optional
grid : bool, optional
    setting this to True will show the grid
diagonal : {'hist', 'kde'}
    pick between 'kde' and 'hist' for
    either Kernel Density Estimation or Histogram
    plot in the diagonal
marker : str, optional
    Matplotlib marker type, default '.'
hist_kwds : other plotting keyword arguments
    To be passed to hist function
density_kwds : other plotting keyword arguments
    To be passed to kernel density estimate plot
range_padding : float, optional
    relative extension of axis range in x and y
    with respect to (x_max - x_min) or (y_max - y_min),
    default 0.05
kwds : other plotting keyword arguments
    To be passed to scatter function

Examples
--------
>>> df = pd.DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
>>> scatter_matrix(df, alpha=0.2)