Message Boards Message Boards

0
|
3041 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Labeling Individual Functions in a Table of Plots

Posted 2 years ago

How do I label individual functions in a plot that contains 25 functions in a list? Where do I put the range for the iteration variable "i" in the String Form of the Callout of the Parametric Plot and Plot? I've tried subsituting \phi on "i" instead but that doesn't work since \phi is the range of the plot and not the iteration from 1 to 25 of the plots.

R[r_] := 2/(5*3)*1/(2*3)!*((2*r)/(5*3))^(2*3)*E^((-2*r)/(5*3))
SampleInitialConditions = N[Table[R[r], {r, 0, 100, 4}]];
SampleInitialConditionsMatrix = 
  List@N[Table[{r, R[r]}, {r, 0, 100, 4}]];

LabelString = Table[StringForm["# ``", LS], {LS, 1, 25}];
ColorList = {Table[{Blend[{Blue, Green, Yellow, Red, Brown}, i]}, {i, 
      1/25, 1, 1/25}]} // Flatten;

ColorList = {Table[{Blend[{Blue, Green, Yellow, Red, Brown}, i]}, {i, 
      1/25, 1, 1/25}]} // Flatten;

LegendWith = 
  SwatchLegend[ColorList, LabelString, 
   LegendLabel -> "With Photophoresis", LegendFunction -> "Frame", 
   LegendLayout -> "Row"];
LegendWithout = 
  SwatchLegend[ColorList, LabelString, 
   LegendLabel -> "Without Photophoresis", LegendFunction -> "Frame", 
   LegendLayout -> "Row"];

ALPHAkWITH = Table[0.002*P*B, {P, 1, 6}, {B, 1, 6}];
ALPHAkWITHOUT = Table[0.001*P*B, {P, 1, 6}, {B, 1, 6}];

NumericalDiffequaWith = 
  Table[NDSolve[{q[\[Phi]] + 
       q''[\[Phi]] == -(ALPHAkWITH[[1, 1]]/(1 + q[\[Phi]]))^2, 
     q[0] == R[r], q'[0] == R[r]}, q, {\[Phi], 0, 100}], {r, 0, 100, 
    4}];

NumericalDiffequaWithout = 
  Table[NDSolve[{q[\[Phi]] + 
       q''[\[Phi]] == -(ALPHAkWITHOUT[[1, 1]]/(1 + q[\[Phi]]))^2, 
     q[0] == R[r], q'[0] == R[r]}, q, {\[Phi], 0, 100}], {r, 0, 100, 
    4}];

NumericalCartesianPlot = Show[ 

   Plot[Callout[Evaluate[q[\[Phi]] /. NumericalDiffequaWith], StringForm["Test # ``", i],Above], {\[Phi], 0, 
     100}, PlotStyle -> ColorList, 
    PlotLegends -> Placed[LegendWith, {Top, Left}], ImageSize -> 900],
   Plot[Callout[Evaluate[q[\[Phi]] /. NumericalDiffequaWithout], StringForm["Test # ``", i],Above], {\[Phi], 0, 
     100}, PlotStyle -> ColorList, 
    PlotLegends -> Placed[LegendWithout, {Bottom, Right}], 
    ImageSize -> 900],
   PlotLabel -> 
    "Positions of With and Without Photophoresis of a particle with 1\[Mu]m",
   Frame -> True
   ]

NumericalParametricPlot1 = Show[ 

   ParametricPlot[
    Evaluate[Callout[{q[\[Phi]], q'[\[Phi]]} /. 
      NumericalDiffequaWith], StringForm["Test # ``", i],Above], {\[Phi], 0, 100}, 
    PlotStyle -> ColorList, 
    PlotLegends -> Placed[LegendWith, {Top, Left}], ImageSize -> 600],
   ParametricPlot[
    Evaluate[Callout[{q[\[Phi]], q'[\[Phi]]} /. 
      NumericalDiffequaWithout], StringForm["Test # ``", i],Above], {\[Phi], 0, 100}, 
    PlotStyle -> ColorList, 
    PlotLegends -> Placed[LegendWithout, {Bottom, Right}], 
    ImageSize -> 600],
   PlotLabel -> 
    "Orbits of With and Without Photophoresis of a particle with 1\[Mu]m",
   Frame -> True
   ]
4 Replies

Lance,

When Labeling multiple curves, the Callout must go in the PlotLabels->.

ParametricPlot[
 Evaluate[{q[\[Phi]], q'[\[Phi]]} /. NumericalDiffequaWith], {\[Phi], 
  0, 100}, 
 PlotLabels -> Table[Callout["Test # " <> ToString[i]], {i, 1, 25}], 
 PlotStyle -> ColorList, 
 PlotLegends -> Placed[LegendWith, {Top, Left}], ImageSize -> 600]

You obviously need to do some placement of the Callouts to make them look right.

Also the way you did the strings (using StringForm) seems wrong.

Regards,

Neil

POSTED BY: Neil Singer

Thank you! This was really helpful.

Regards, Lance

Posted 2 years ago

Quick glance at this, and it looks to me like you've switched Evaluate and Callout in the ParametricPlots. I can't quite tell based on how you asked your question whether this is the issue, but maybe fix that first and let us know what happens.

POSTED BY: Eric Rimbey

Thanks, I've fixed that part now. Those errors are no longer present. But the labels are still missing.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract