def crossplot(dat, keys=None, lognorm=True, bins=<NUM_LIT>, figsize=(<NUM_LIT:12>, <NUM_LIT:12>),<EOL>colourful=True, focus_stage=None, denominator=None,<EOL>mode='<STR_LIT>', cmap=None, **kwargs):
if keys is None:<EOL><INDENT>keys = list(dat.keys())<EOL><DEDENT>numvar = len(keys)<EOL>if figsize[<NUM_LIT:0>] < <NUM_LIT> * numvar:<EOL><INDENT>figsize = [<NUM_LIT> * numvar] * <NUM_LIT:2><EOL><DEDENT>fig, axes = plt.subplots(nrows=numvar, ncols=numvar,<EOL>figsize=(<NUM_LIT:12>, <NUM_LIT:12>))<EOL>fig.subplots_adjust(hspace=<NUM_LIT>, wspace=<NUM_LIT>)<EOL>for ax in axes.flat:<EOL><INDENT>ax.xaxis.set_visible(False)<EOL>ax.yaxis.set_visible(False)<EOL>if ax.is_first_col():<EOL><INDENT>ax.yaxis.set_ticks_position('<STR_LIT:left>')<EOL><DEDENT>if ax.is_last_col():<EOL><INDENT>ax.yaxis.set_ticks_position('<STR_LIT:right>')<EOL><DEDENT>if ax.is_first_row():<EOL><INDENT>ax.xaxis.set_ticks_position('<STR_LIT>')<EOL><DEDENT>if ax.is_last_row():<EOL><INDENT>ax.xaxis.set_ticks_position('<STR_LIT>')<EOL><DEDENT><DEDENT>if colourful:<EOL><INDENT>cmlist = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>cmlist = ['<STR_LIT>']<EOL><DEDENT>if cmap is None and mode == '<STR_LIT>':<EOL><INDENT>cmap = {k: '<STR_LIT:k>' for k in dat.keys()}<EOL><DEDENT>while len(cmlist) < len(keys):<EOL><INDENT>cmlist *= <NUM_LIT:2><EOL><DEDENT>focus = {k: nominal_values(dat[k]) for k in keys}<EOL>udict = {a: unitpicker(np.nanmean(focus[a]),<EOL>focus_stage=focus_stage,<EOL>denominator=denominator) for a in keys}<EOL>rdict = {a: (np.nanmin(focus[a] * udict[a][<NUM_LIT:0>]),<EOL>np.nanmax(focus[a] * udict[a][<NUM_LIT:0>])) for a in keys}<EOL>for i, j in tqdm(zip(*np.triu_indices_from(axes, k=<NUM_LIT:1>)), desc='<STR_LIT>',<EOL>total=sum(range(len(keys)))):<EOL><INDENT>ai = keys[i]<EOL>aj = keys[j]<EOL>pi = focus[ai] * udict[ai][<NUM_LIT:0>]<EOL>pj = focus[aj] * udict[aj][<NUM_LIT:0>]<EOL>if lognorm:<EOL><INDENT>norm = mpl.colors.LogNorm()<EOL><DEDENT>else:<EOL><INDENT>norm = None<EOL><DEDENT>if mode == '<STR_LIT>':<EOL><INDENT>pi = pi[~np.isnan(pi)]<EOL>pj = pj[~np.isnan(pj)]<EOL>axes[i, j].hist2d(pj, pi, bins,<EOL>norm=norm,<EOL>cmap=plt.get_cmap(cmlist[i]))<EOL>axes[j, i].hist2d(pi, pj, bins,<EOL>norm=norm,<EOL>cmap=plt.get_cmap(cmlist[j]))<EOL><DEDENT>elif mode == '<STR_LIT>':<EOL><INDENT>axes[i, j].scatter(pj, pi, s=<NUM_LIT:10>,<EOL>color=cmap[ai], lw=<NUM_LIT:0.5>, edgecolor='<STR_LIT:k>',<EOL>alpha=<NUM_LIT>)<EOL>axes[j, i].scatter(pi, pj, s=<NUM_LIT:10>,<EOL>color=cmap[aj], lw=<NUM_LIT:0.5>, edgecolor='<STR_LIT:k>',<EOL>alpha=<NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>axes[i, j].set_ylim(*rdict[ai])<EOL>axes[i, j].set_xlim(*rdict[aj])<EOL>axes[j, i].set_ylim(*rdict[aj])<EOL>axes[j, i].set_xlim(*rdict[ai])<EOL><DEDENT>for a, n in zip(keys, np.arange(len(keys))):<EOL><INDENT>axes[n, n].annotate(a + '<STR_LIT:\n>' + udict[a][<NUM_LIT:1>], (<NUM_LIT:0.5>, <NUM_LIT:0.5>),<EOL>xycoords='<STR_LIT>',<EOL>ha='<STR_LIT>', va='<STR_LIT>', fontsize=<NUM_LIT:8>)<EOL>axes[n, n].set_xlim(*rdict[a])<EOL>axes[n, n].set_ylim(*rdict[a])<EOL><DEDENT>for i, j in zip(range(numvar), itertools.cycle((-<NUM_LIT:1>, <NUM_LIT:0>))):<EOL><INDENT>axes[j, i].xaxis.set_visible(True)<EOL>for label in axes[j, i].get_xticklabels():<EOL><INDENT>label.set_rotation(<NUM_LIT>)<EOL><DEDENT>axes[i, j].yaxis.set_visible(True)<EOL><DEDENT>return fig, axes<EOL>
Plot analytes against each other.

The number of plots is n**2 - n, where n = len(keys).

Parameters
----------
dat : dict
    A dictionary of key: data pairs, where data is the same
    length in each entry.
keys : optional, array_like or str
    The keys of dat to plot. Defaults to all keys.
lognorm : bool
    Whether or not to log normalise the colour scale
    of the 2D histogram.
bins : int
    The number of bins in the 2D histogram.
figsize : tuple
colourful : bool

Returns
-------
(fig, axes)