Message Boards Message Boards

[?] Avoid red screens in Manipulate?

Hi, The attached file includes my own Demonstration and one found in Wolfram, both created by Mathematica 10 and worked perfectly. When I tried to use it with the new Mathematica 11, it does not work properly (it seems to be the "Epilog" that creates the problem). I would be happy if somebody can solve the issue!

Attachments:
4 Replies
Posted 7 years ago

After taking a quick glance at your notebook, it looks like the issue is introduced when your Plot's Epilog option is trying to show graphics that rely on the variable that Plot is localizing. The following is a simpler example which demonstrates the same issue:

Manipulate[
 Plot[Sin[x], {x, 0, 10}, 
  Epilog -> ReleaseHold[Point[{x, Sin[x]}]]], {x, 0, 10}]

If needed, this can be worked around by using a different variable for your Epilog plotting than for your Plot, for example a simple fix that you can implement could be something like:

Manipulate[a = x;
 Plot[Sin[x], {x, 0, 10}, Epilog -> Point[{a, Sin[a]}]], {x, 0, 10}]

This did seem to work well in earlier versions, so I'll report the regression.

Kyle

POSTED BY: Kyle Martin

Thanks Very much Kyle! The first alternative was still "Red", while the second alternative worked exactly as it worked with Mathematica 10.3 last year. I expected the new version would simplify things...

Christos

Additionally you can add Dynamic to the Epilog so the whole Plot does not need to be regenerated to change Point position:

Manipulate[
 Plot[Sin[x], {x, 0, 10}, 
  Epilog -> {AbsolutePointSize@7, Dynamic@Point[{a, Sin[a]}]}], 
 {a, 0,   10}
]
POSTED BY: Kuba Podkalicki

Thanks Jakob! I will try that too.

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