I have a Manipulate[ListPlot[data[[m;;n]],{m,1,10},{n,1,10}]. I execute, the plot is shown, I save the notebook, close Mathematica. I run Mathematica again, start executing code that is completely unrelated and I get thrown errors in Manipulate because at that point the list data is not existing. I even tried to use TrackedSymbols :> {m, n} without any help, as soon as I execute anything in the notebook after opening, Manipulate tries to update the plot, which is clearly not wanted.

Is there a way to get around this? It is incredibly annoying, especially when you do Manipulate[ListPlot[{data[[m;;n]],data2[[m;;n]]},{m,1,30000},{n,1,30000}] and at one point data exists and data2 does not, then this line will print the whole, unabbreviated content of data, that is the dimension of {30000,2} and Mathematica front-end slows to a crawl.

Btw. this even looks like a bug (I am on 13.2.1 Linux).


1 Answer 1


(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)



data = RandomReal[10, {3, 20, 2}];

If you are going to plot a span of data, I recommend that you use an IntervalSlider

 ListPlot[Evaluate[#[[int[[1]] ;; int[[2]]]] & /@ data],
  PlotRange -> MinMax /@ Transpose[Join @@ data],
  Frame -> True,
  PlotRangeClipping -> False,
  PlotRangePadding -> Scaled[.05],
  PlotMarkers -> "OpenMarkers",
  PlotLegends -> Automatic],
 {{int, {1, Length@data[[1]]}, "interval"}, 1, Length@data[[1]], 1,
  ControlType -> IntervalSlider,
  Method -> "Push",
  MinIntervalSize -> 5,
  Appearance -> "Labeled"},
 TrackedSymbols :> {int}]

enter image description here


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.