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?


1 Answer 1


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

 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 *)
  • $\begingroup$ What does disabled by default mean? $\endgroup$
    – soandos
    Jan 16, 2013 at 8:36
  • 1
    $\begingroup$ @soandos By "disabled" he means the option set to a value that doesn't do anything, e.g. None. $\endgroup$
    – Mr.Wizard
    Jan 16, 2013 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.