# Can I add legends to a SmoothHistogram?

Under the options menu for Histogram, there is an option called ChartLegends, which adds little boxes beside the plot to indicate which curve represents what. I cannot find a similar option for SmoothHistogram. I know that PlotLegends is new in version 9, and I would've expected the option to be valid for SmoothHistogram as well. Does anybody know of a way around this issue?

-

Even though the documentation for SmoothHistogram doesn't explicitly mention PlotLegends as an option, it is a valid option and works as expected:

SmoothHistogram[
Table[RandomVariate[NormalDistribution[c, 1], 500], {c, 0, 3}],
PlotLegends -> {"0", "1", "2", "3"}]


In general, it's a good idea to try out options that you think should work (for functions where it makes sense), but is missing in the documentation. More often, it's the case that the documentation is either lacking or the option was left out to make room for other more important ones.

You should also check if these options were defined for the function and disabled by default, which happens to be the case with SmoothHistogram:

Options[SmoothHistogram, PlotLegends]
(* PlotLegends -> None *)

-
What does disabled by default mean? –  soandos Jan 16 '13 at 8:36
@soandos By "disabled" he means the option set to a value that doesn't do anything, e.g. None. –  Mr.Wizard Jan 16 '13 at 8:49