# Plotlabel in Monitor

I am using three For loops and would like to show a series of plots in the same window. I am using Monitor and I want to see the parameters in each plot. Here is my code:

Monitor[For[i = 1, i < 40, i++,
For[j = 1, j < 40, j++,
For[k = 20, k < 40, k++, p =
Show[ListPlot[data],
Plot [{
10^3 x  (4 7^2 + (y^2 - R^2 ))/(y^2 - R^2 )^3 /. R -> i} /.
FindRoot[
y == Subscript[\[Omega], 0]
Sqrt[1 +
k Subscript[\[Omega], 0]/
y (1/(Exp[y/x] - 1) + 1/2 -
y/(2 Subscript[\[Omega],
0]))] /. {Subscript[\[Omega], 0] -> j}, {y,
1}], {x, 1, 300}, PlotLabel -> {"R,k,j"}]]]]],
EventHandler[p, {"MouseDown" :> i++}]]


And I want to know what is my i,j,k for each plot.

• @m_goldberg Please let me know which part is vague or not well-posted to improve. However, I don't "beg as a free debugging service". – Kassik Oct 14 '17 at 8:17
• You need to explain what the problem is. What is going wrong or what feature needs to be added to make do what you want? Your post basically just dumps the code and says "fix it". – m_goldberg Oct 14 '17 at 15:09
• I am sorry for my poor explanation. My code runs and plots for different i, j and k values but I am not able to see which plot is linked to which set of {i,j,k}. I want to know how plots are changing as {i,j,k} changes. – Kassik Oct 14 '17 at 20:06
• The simplest thing to do is make the PlotLabel contain the values for i, j and k as shown below. – Jack LaVigne Oct 14 '17 at 21:53

As I read your problem you wanted to see all of the plots in the same window (it was not clear to me whether you wanted one plot at a time followed by a mouse click to change plots). This answer attempts to show both methods.

## Part 1 - All of the plots at the same time

I have reduced your problem to only showing two plots for each iterator. You can certainly use 20 plots for each iterator as shown in your question but this would make 8000 figures.

I think that is best to use Table rather than a For loop and Monitor. Flatten is used to make a single (rather than nested) list of the results and displayed in a Column.

I replaced R with i rather than make a substitution.

Flatten[
Table[
Table[
Table[
Show[
Plot[
10^3 x (4 7^2 + (y^2 - i^2))/(y^2 - i^2)^3 /.
FindRoot[
y == j Sqrt[1 + k j/y (1/(Exp[y/x] - 1) + 1/2 - y/(2 j))], {y,1}],
{x, 1, 300},
PlotLabel ->
"i="<>ToString[i]<>", j="<>ToString[j]<>", k="<>ToString[k]
]
],
{k, 20, 21}
],
{j, 1, 2}
],
{i, 1, 2}
]
]


## Part 2 - Single plot

In order to show one plot at a time, I recommend using Manipulate and selecting the i, j and k values to display.

Manipulate[
Show[
Plot[
10^3 x (4 7^2 + (y^2 - i^2))/(y^2 - i^2)^3 /.
FindRoot[
y == j Sqrt[1 + k j/y (1/(Exp[y/x] - 1) + 1/2 - y/(2 j))], {y, 1}],
{x, 1, 300},
PlotLabel ->
"i="<>ToString[i]<>", j="<>ToString[j]<>", k="<>ToString[k]
]
],
{{i, 1}, Range[20]},
{{j, 1}, Range[20]},
{{k, 20}, Range[20, 40]}
]


• Thank you for your answer and I am really sorry for my poor explanation. My code runs and plots for each iteration and I want to know what is set of {i,j,k} for each plot and I want to see them all in one window but It would be better to not change parameters each time by hand. – Kassik Oct 14 '17 at 20:13
• @Kassik I think then that you want the second, Manipulate answer. To see it run click on the + sign in the upper right hand corner and then click on Autorun from the pull down menu. It goes by very fast so you could add the line Pause[0.5]; just before the Show[... to get it to pause for a half second for each picture. – Jack LaVigne Oct 14 '17 at 21:43
• Thank you. It works perfectly. – Kassik Oct 15 '17 at 3:16