How can I label a table of histograms with the names of the data symbols, not the data themselves?
If I want to make a table of plots with each plot labeled with the name of the function it plots, this is simple:
f[x_] := x; g[x_] := x^2;
Table[Plot[p[x], {x, -1, 1}, PlotLabel -> p], {p, {f, g}}]
However, if I want to do the same for Histogram
, I have not figured out how. I have tried various combinations using ToString
, Hold
, HoldForm
, and Unevaluated
, as well as ChartLabels
. For example,
l = RandomReal[{0, 1}, 20]; m = RandomReal[{0, 1}, 20];
Table[Histogram[p, PlotLabel -> p], {p, {l, m}}]
does not work, as the labels are the values of l
and m
, not the strings l
and m
.
The same question applies to the format analogous to
Plot[#[x], {x, -1, 1}, PlotLabel -> #] & /@ {f, g}
which works for Plot
but not for Histogram
.