I have created some simple code which generates a plot. This plot contains a family of curves created by changing a single parameter "k". I use the Table function within the Show function to iterate through the desired values of "k" which in turn creates the family of curves. The code and resultant plot is shown below:

ur[x_, a_] := 1 - (1/a)*Log[1 + a x]
g[x_, go_, s_, m_] := 1/2 (go*x*Exp[-(x/s)])/(1 + m x)

uh[x_, a_, go_, s_, m_, k_] := ur[x, a] + g[x, go, s, m]/(1 - g[x, go, s, m]) (k - 1)

(* initialize parameters *)
a = 5; go = 1; s = 2; m = 0.5; 

plt[k_] := ParametricPlot[{ uh[x, a, go, s, m, k], x}, {x, 0, 1}, 
           PlotRange -> {0.6, 1.4}, {0, 1.5}}, AspectRatio -> 1/1.5, 
           Frame -> True, PlotStyle -> {Darker[Green]}, 
           FrameLabel -> {Style["Normalized Volume", 16], 
           Style["Normalized Pressure", 16]},
           LabelStyle -> {FontSize -> 14, FontFamily -> "Times"}]

Show[Table[plt[k], {k, 1.0, 3.5, 0.5}]]

This is the created plot from the code above

The question is, "How do you create a plot with labeling generated by the Table function?" This question seems similar to another question recently asked, but I was not able to fold that solution into my code framework. The desired plot might look something like the following image... desired plot

Thank you in advance for any suggestions and/or comments.

  • 2
    $\begingroup$ Use the end coordinates of your plots to place appropriate Text , e.g. using Epilog or Show. $\endgroup$ – Yves Klett May 7 '13 at 18:47
  • $\begingroup$ One might find an example here if you examine the answers: mathematica.stackexchange.com/questions/4444/… $\endgroup$ – Artes May 7 '13 at 19:17
  • $\begingroup$ By "dynamically," do you really mean you want to place the labels programmatically based on the coordinates computed in Table? In Mathematica lingo, "dynamic" placement would usually be interpreted as "interactive" manipulation. $\endgroup$ – Jens May 7 '13 at 23:38
  • $\begingroup$ I guess, "programmatically" is a better word than "dynamically". The desired result is to have the code make the approximate placement. I goofed with a poor word choice. $\endgroup$ – Joseph May 8 '13 at 0:44

You could add in a label function:

label[k_, x_] := Graphics@Text["k = " <> ToString[k], {uh[x, a, go, s, m, k], x}, {0, -1}];

Then show it all together:

Show[Table[{plt[k], label[k, 1]}, {k, 1.0, 3.5, 0.5}]]


| improve this answer | |
  • $\begingroup$ Thank you for your help! This is what I needed. A function to programmatically place a label. Very Nice! I guess the question I asked was similar to other questions I just could not see a solution from the answers. I'm still learning. $\endgroup$ – Joseph May 8 '13 at 16:00

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