Possible Duplicate:
How do I label different curves in Mathematica?
Using Mathematica, I would like to programmatically add text labels to each member of a family of curves. I'd prefer not to use a legend. Here's an example:
f[x_, a_] := a*x
myplot = Plot[Evaluate@Table[f[x, a], {a, {0.5, 1, 2}}], {x, -5, 5}]
mytext = Graphics[Evaluate@Table[Text["a = " <> ToString[a],
{5, f[5, a]}, {1, 0}], {a, {0.5, 1, 2}}]]
Show[myplot, mytext]
There has to be a better or more standard way of doing this...right? My hack isn't terribly pretty. The text bleeds into the plot for a = 1 and a = 0.5
I went through the interactive way of adding text labels as outlined by Add Text to a Graphic. I'd really like to do this programmatically though.
What do people do in practice? Do people prefer to interactively add labels because of the potential headache of doing it programmatically?