Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am graphing the 4 PDFs for a distribution for 4 different parameters in the same graph. I want the values of the parameters to be shown in corner of the graph. How do I do this?

share|improve this question
You can use Text[], among other things. However, it would be nice if you could show a picture of what you're expecting to see from us... – J. M. May 4 '12 at 3:25
Something like this:… – Chris May 4 '12 at 3:32
Oh, you want a legend. That's slightly tricky business, and it has been discussed a number of times before here. Have a look at these. – J. M. May 4 '12 at 3:49
Although I answered the question, I realize this is a duplicate of Creating legends for plots with multiple lines? - so it's justified to close this, I think. – Jens May 4 '12 at 4:20
up vote 5 down vote accepted

The following is what you get using the code posted in my answer linked here:

All you have to do is make the plot, and call the function autoLegend I defined in the link:

styles = {Black, Directive[Dashed, Black], 
  Directive[DotDashed, Black], Directive[Dotted, Black]}
parameters = {1/2, 1/3, 1/5, 1/1000};
p = Plot[Evaluate[
    PDF[ExponentialDistribution[#]][x] & /@ parameters], {x, 0, 50}, 
   AxesOrigin -> {0, 0}, PlotStyle -> styles];
autoLegend[p, parameters]


share|improve this answer
So cool, thanks alot! :) – Chris May 4 '12 at 5:13

Your Answer


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.