# PlotLabels with Evaluate

I am plotting a function for different values of a parameter (a). How can I use PlotLables to show the values of the parameter on each curve? Why PlotLabels -> Values@a doesn't work here?

gamma4 = .4; gamma3 = .284; gamma2 = .265; gamma1 = .484; z3 = 10000; \
z2 = 32000; z1 = 75000; zbar4 = 4800; zbar3 = 20050; zbar2 = 46200;
zbar1 = 138100; h4 = .301; h3 = .404; h2 = .25;
h1 = .045; p1 = 3.89; p2 = 4.92; p3 = 5.22;
p4 = 5.39; g1 = 0; g2 = 0.44; g3 = 0.88; g4 = 1.76;

Gain = h2 (zbar2 - z2) +
h1 (z1 - z2) + (a (g1 p1 + (g2  p2 /\[Tau]2) + g3 p3 + g4 p4) -
1 ) h2 zbar2   gamma2 (\[Tau]2/(1 - \[Tau]2));

Show[Plot[
Evaluate@Table[Gain, {a, 0.05, 0.09, 0.01}], {\[Tau]2, 0, 1},
PlotLabels -> Values@a]]


Thanks,

• The primary reason is that a is undefined. It is a local variable inside of Table and a global symbol (that is undefined) when used in PlotLabels. Second problem is that Values applies to Associations, not lists and should be removed – Jack LaVigne Sep 2 '17 at 2:29

## 1 Answer

You could create the data and use it as follows

Gain=h2 (zbar2-z2)+h1 (z1-z2)+(a (g1 p1+(g2 p2/\[Tau]2)+g3 p3+g4 p4)-1)
h2 zbar2 gamma2 (\[Tau]2/(1-\[Tau]2));
data=Table[a,{a,0.05,0.09,0.01}];  (*add this line *)

Show[Plot[Evaluate@Table[Gain,{a,data}],{\[Tau]2,0,1},PlotLabels->data]] You can play with options to PlotLabels to improve positions of labels if needed.