# Plotting a family of curves

GROUPS:
 Hello, I have the following issue:I need to plot a 2D function with various values of a parameter. i.e. f(x)=ax+5, on the same plot.This is easily accomplished. Now i need to put on each curve the respective value of parameter a. Any ideas how can this be achieved?
4 years ago
6 Replies
 One possibility is to use Tooltips.  The value will not be visible until the mouse is over the curve.  So this may not be what you want (especially if you want to export the plot to another enviornment). Plot[Evaluate@Table[Tooltip[a x + 5, a], {a, 1, 5}], {x, 0, 3}]The challenge for actually putting the value on the curve itself (and there are many ways to do this) is that you may not know ahead of time if the shown values will be (a) sufficiently separated to not be on top of each other and (b) not be ambiguous because curves are close to each other. In a case like this I'd generally choose a plot legend as in Plot[Evaluate@Table[a x + 5, {a, 1, 5}], {x, 0, 3}, PlotLegends -> Automatic]But if you want to put the values on the plot, and you know that they will be clear, then you can use Epilog with something like Text. Module[{textData},    textData =    With[{x = 2}, Table[Text[a, {x, a x + 5}, {0, -1}], {a, 1, 5}]];    Plot[Evaluate@Table[Tooltip[a x + 5, a], {a, 1, 5}], {x, 0, 3},    Prolog -> textData]    ]
4 years ago
 You can add the labels by hand using the drawing tools. Right-click the graphic and select "Drawing Tools" from the menu. Then use the text tools.You can then right-click the graphic and use "Save As" to save the annotated graphic to a file.
4 years ago
 By hand?  What a concept.  Very retro...  ;-)But a good idea.