I have tried to make my own Manipulate module that draws numerical trajectories in 2D space depending on 1 parameter.
The problem is that I have this caution in title for every variable in Show
.
I understand that it is related to some dynamic functionality, but I still don't know how to get rid of it.
Also, it will be great if I can get rid of the local variable name (k$8245) in output of this module.
MyManipulatePlot2D[list_, opts : OptionsPattern[]] :=
Module[{mv, pr, rt, constPlots, k},
{rt, mv, pr} = Dimensions[list];
constPlots = Table[ListPlot[list[[i,;;, 1 ;; 2]], opts], {i, rt}];
Manipulate[
Show[constPlots[[k]]], {k, 1, rt, 1}]
]
P.S. I don't want to take Manipulate
out of the Module
, because in my code this function is way more complex and it actually draws trajectories depending on 2 parameters.
Right here if someone is interested
MyManipulatePlot2D[list_, opts : OptionsPattern[]] :=
Module[{rt, mv1, pr, constPlots, k1, mv2, i, k2, pointsPlot},
{rt, mv1, mv2, pr} = Dimensions[list];
constPlots =
Table[ListPlot[
ArrayReshape[list[[;; , i, ;; , ;;]], {rt*mv2, pr}][[;; ,
1 ;; 2]], PlotStyle -> ColorData[97, "ColorList"][[2]],
opts], {i, mv1}];
pointsPlot = list[[;; , ;; , ;; , 1 ;; 2]];
pointsPlot = ArrayReshape[pointsPlot, {rt, mv1, mv2, 1, 2}];
Manipulate[
Show[{constPlots[[k1]],
ListPlot[pointsPlot[[;; , k1, k2]],
PlotLegends ->
Placed[ToString[{list[[1, k1, k2, 3]], list[[1, k1, k2, 4]]}],
Top]]}], {k1, 1, mv1, 1}, {k2, 1, mv2, 1}]
]
I have tried experementing with Evaluate
funtion but it didn't work out.
You can fix the k$8245
problem by using Block instead of Module, or you can use a label "k"
as below. k$8245
is the module's local variable name so it is showing as expected, even though not what you want. No other problems observed.
MyManipulatePlot2D[list_, opts : OptionsPattern[]] :=
Module[{mv, pr, rt, constPlots, k}, {rt, mv, pr} = Dimensions[list];
constPlots = Table[ListPlot[list[[i, ;; , 1 ;; 2]], opts], {i, rt}];
Manipulate[Show[constPlots[[k]]], {{k, 1, "k"}, 1, rt, 1}]]
The second manipulate just errors disasterously.