0
$\begingroup$

How can I make the curve labels in Plot to show the parameter's name in addition to its number?

(MSC=100 instead of just 100 in the following graph)

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;


Cost2 = (g2 + 
      MSC (g1 p1 h1 + g2 p2 (h2 - 1) + g3 p3 h3 + 
         g4 p4 h4)) h2 (zbar2 - 
      z2) - (MSC (g1 p1 h1 + g2  p2 (h2 + (1 - τ2)/τ2) + 
        g3 p3 h3 + g4 p4 h4)) h2 zbar2 gamma2 (τ2/(1 - τ2));

Show[Plot[
  Evaluate@Table[Cost2, {MSC, {0,  0.06, 1, 2, 100}}], {τ2, 0, 
   1}, PlotRange -> {{0, 0.15}, {0, 11000}}, 
  PlotRangePadding -> {{0, 1}, {0, 0}}, 
  PlotLabels -> Placed[ Table[MSC, {MSC, {0, "" , 1, 2, 100}}], Top]]]
$\endgroup$
1
$\begingroup$

Use StringForm. Note that you may have to add some more padding to see all the labels.

Show[Plot[
  Evaluate@Table[Cost2, {MSC, {0, 0.06, 1, 2, 100}}], {\[Tau]2, 0, 1},
   PlotRange -> {{0, 0.15}, {0, 11000}}, 
  PlotRangePadding -> {{0, 1}, {0, 0}}, 
  PlotLabels -> 
   Placed[Table[
     StringForm["MSC =  ``.", MSC], {MSC, {0, "", 1, 2, 100}}], Top]]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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