0

Why are the errors below thrown? They are very strange and seem to be incorrect.

Error 1

ListLinePlot3D[Map[Dynamic, {{1, 2}, {1, 3}}, {2}]]

1

Error 2

ListLinePlot3D[Dynamic[{{1, 2}, {1, 3}}]]

2

  • All three of the following throw no errors and give the correct output.
ListLinePlot3D[{{1, 2}, {1, 3}}]

Dynamic[{{1, 2}, {1, 3}}]

Dynamic[ListLinePlot3D[{{1, 2}, {1, 3}}]]

Notice the last two include Dynamic applied to a literal, and they work fine with no errors.

So the problem seems to be with ListLinePlot3D[Dynamic[...],...].

Update

I understand a Dynamic on a literal will not do anything. The code here are minimal examples whittled down from more complex and pragmatic code, and the same errors are given when Dynamic is applied to a non-literal. I chose literals to make the minimal examples simplest. The code shown should work, even if Dynamic doesn't do anything useful.

Just Some Old Man
  • 1,607
  • 1
  • 9
  • 12
  • 2
    What are you attempting to do? Dynamic on a literal will not do anything because a literal cannot change its value. – Edmund Apr 15 '22 at 00:22
  • I’m trying to figure out why these errors are thrown. It doesn’t seem like these errors make sense. The practical function I am using is more complex than this, but I reduced the problem to this. My overall code is of the form ListLinePlot3D[Dynamic[…]]. – Just Some Old Man Apr 15 '22 at 04:47
  • @JustSomeOldMan - I don't know if that would work in general, why not Dynamic[ListLinePlot3D[...]]? – Jason B. Apr 20 '22 at 18:40
  • All of the Plot functions do a lot of funky stuff. They need to hold evaluation of the function part to some extent, but they also do a ton of other stuff to set up the visualization. I personally don't know exactly why your case is throwing an error, but it doesn't surprise me at all that it does. – lericr Apr 20 '22 at 19:38
  • 1
    On another topic, nested Dynamics and superfluous Dynamics sometimes end up doing weird things (or at least things that seem weird to me). If you really need a Dynamic, I suggest you put it as far to the "outside" of the expression as possible, ideally the outermost wrapper. Except, of course, in the cases of controls that are specifically designed to take Dynamic expressions as arguments. – lericr Apr 20 '22 at 19:38
  • 2
    @JustSomeOldMan The linked topic is not about plots but I think it identifies the culprit here. Let me know if you disagree. – Kuba Apr 20 '22 at 20:04
  • The trouble in this particular case is that ListLinePlot3D[data] tries to rewrite data into Point and Line objects, stripping wrappers from the data like Tooltip and rewrapping them around the Point and Line objects as appropriate. Unfortunately, it is not programmed to do that with Dynamic. Basically if it dealt with ListLinePlot3D[Dynamic@data], then whenever data changed, the whole ListLinePlot3D[] would have to re-execute, and it would effectively behave just like Dynamic@ListLinePlot3D[data]. Maybe that's why they didn't implement ListLinePlot3D[Dynamic@data]. – Michael E2 Apr 22 '22 at 04:37
  • @lericr That seems to be the solution, but its a bit unfortunate though because performance seems to be better with inner Dynamics, in my very limited experience. – Just Some Old Man Apr 22 '22 at 20:52

0 Answers0