Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 12 down vote accepted

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 *)
share|improve this answer
    
What does disabled by default mean? –  soandos Jan 16 '13 at 8:36
1  
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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