def histograms(dat, keys=None, bins=<NUM_LIT>, logy=False, cmap=None, ncol=<NUM_LIT:4>):
if keys is None:<EOL><INDENT>keys = dat.keys()<EOL><DEDENT>ncol = int(ncol)<EOL>nrow = calc_nrow(len(keys), ncol)<EOL>fig, axs = plt.subplots(nrow, <NUM_LIT:4>, figsize=[ncol * <NUM_LIT:2>, nrow * <NUM_LIT:2>])<EOL>pn = <NUM_LIT:0><EOL>for k, ax in zip(keys, axs.flat):<EOL><INDENT>tmp = nominal_values(dat[k])<EOL>x = tmp[~np.isnan(tmp)]<EOL>if cmap is not None:<EOL><INDENT>c = cmap[k]<EOL><DEDENT>else:<EOL><INDENT>c = (<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0.5>)<EOL><DEDENT>ax.hist(x, bins=bins, color=c)<EOL>if logy:<EOL><INDENT>ax.set_yscale('<STR_LIT>')<EOL>ylab = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>ylab = '<STR_LIT:n>'<EOL><DEDENT>ax.set_ylim(<NUM_LIT:1>, ax.get_ylim()[<NUM_LIT:1>])<EOL>if ax.is_first_col():<EOL><INDENT>ax.set_ylabel(ylab)<EOL><DEDENT>ax.set_yticklabels([])<EOL>ax.text(<NUM_LIT>, <NUM_LIT>, k, ha='<STR_LIT:right>', va='<STR_LIT>', transform=ax.transAxes)<EOL>pn += <NUM_LIT:1><EOL><DEDENT>for ax in axs.flat[pn:]:<EOL><INDENT>ax.set_visible(False)<EOL><DEDENT>fig.tight_layout()<EOL>return fig, axs<EOL>
Plot histograms of all items in dat.

Parameters
----------
dat : dict
    Data in {key: array} pairs.
keys : arra-like
    The keys in dat that you want to plot. If None,
    all are plotted.
bins : int
    The number of bins in each histogram (default = 25)
logy : bool
    If true, y axis is a log scale.
cmap : dict
    The colours that the different items should be. If None,
    all are grey.

Returns
-------
fig, axes