Below you find a very minimal version of a code, where the Manipulate keeps updating (run is constantly printed) despite the Tracked symbol not being changed. Funny enough, this only happens if d1 and d2 are True (check both boxes). Moreover, if I change the functions f1 or f2 in the simplest way, e.g. setting f1=f2 or changing the scaling in f2 from {0,0.5} to {0.1}, this error stops - but I really don't understand why.

Thanks for your help!

cf[z_] := RGBColor[z, 1 - z, 0];

(* BarLegend 1*)
f1[x_] := BarLegend[{"Rainbow", {0, 1}}]

(* Barlegend 2*)
f2[x_] := BarLegend[{cf[#] &, {0, 0.5}}]

 {If[d1, f2[1], Nothing],
  If[d2, f1[1], Nothing]}
 , {{d1, True, "show 1)"}, {False, True}},
 {{d2, True, "show 2)"}, {False, True}},
 Button["run", run = 1 - run], {{run, 0}, ControlType -> None}, 
 TrackedSymbols :> {run}]
  • $\begingroup$ I am using MacOS by the way $\endgroup$
    – Tim
    Sep 1, 2021 at 14:42
  • $\begingroup$ You should give the version number of Mathematica also. This looks like a bug. It works OK on 11.3, 12 and 12.2 but not on 12.3.1. All on windows 10. $\endgroup$
    – Nasser
    Sep 1, 2021 at 15:16
  • $\begingroup$ Thanks for the quick reply - I actually use version 12.3.1., so really could be the bug you mentioned :-) $\endgroup$
    – Tim
    Sep 1, 2021 at 19:20

2 Answers 2


As noted in the comments, this is a bug in Mathematica 12.3. To fix it, evaluate the following:

 prot = Unprotect@ArrayPlot;
 DownValues@ArrayPlot = DownValues@ArrayPlot /.
   expr : HoldPattern@Catch@_[md_, ___] :> Module[{md}, expr];
 Protect /@ prot;

Now, your code should work as expected.

  • $\begingroup$ This worked for me - thanks a lot Lukas! I have to admit, I am too new to Mathematica to understand what exactly this does - but thanks for your help :-) $\endgroup$
    – Tim
    Sep 1, 2021 at 19:29
  • $\begingroup$ @Tim don't worry about not understanding this - it's super obscure and I didn't explain it at all (I felt like it wouldn't add any real value). But if you'd be interested in some details on how it works, I could add some. $\endgroup$
    – Lukas Lang
    Sep 1, 2021 at 21:31
  • $\begingroup$ I am always eager to learn more :-D - just not sure how easily this can be explained in a comment^^ Btw, although the proposed solution worked for the exact minimal example I posted here, I keep having some issues with a more complex version, where calling functions that appear inside the Manipulate environment somewhere else in the notebook triggers the Manipulate to update (despite no change of the TrackedSymbols). Don't have the time to break it down to a new minimal example - but there really seems to be some bug. $\endgroup$
    – Tim
    Sep 2, 2021 at 15:56

Why Trackedsymobls behaves so strange is often a mystery, and only developers from Wolfram Research can give all reasons. However, you have more control over TrackedSymbols if used in Dynamic:


(*BarLegend 1*)

(*Barlegend 2*)

  TrackedSymbols :> {run,d1,d2}
{{d1,True,"show 1)"},{False,True}},{{d2,True,"show 2)"},{False,True}},
  • $\begingroup$ Thanks Rolf for your feedback - will keep this in mind for the future :-) $\endgroup$
    – Tim
    Sep 1, 2021 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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