I have a graphic that consists of a ListPlot3D and a ListPointPlot3D. I want to only display part of the data for the second plot up to an nth index. That data is in pointsDgd3DOpt
, so I select with pointsDgd3DOpt[[;; nEndpoint]]
. That variable is in manipulate. But the first plot is slow and should not be updated when that variable changes. I've read in the "Advanced Manipulate Functionality" article how to do that in general (an inner dynamic). But that doesn't really work for me.
Without dynamic, it works but is slow:
pointsDgd3D =
Import[FileNameJoin[{NotebookDirectory[],
"filter_small_space.txt"}], "CSV"];
pointsDgd3DOpt =
Import[FileNameJoin[{NotebookDirectory[],
"filter_small_space_opt.txt"}], "CSV"];
func = Interpolation[pointsDgd3D];
Manipulate[
Show[{
ListPlot3D[pointsDgd3D,
PlotRange -> Dynamic[{0, 3}]
],
ListPointPlot3D[
pointsDgd3DOpt[[;; nEndpoint]],
PlotRange -> {0, 3}
]
}],
{nEndpoint, 1, 300, 1}
]
And with it spews "must be a valid array or a list of valid arrays" errors:
Manipulate[
Show[{
ListPlot3D[pointsDgd3D,
PlotRange -> {0, 3}
],
ListPointPlot3D[
Dynamic[pointsDgd3DOpt[[1 ;; nEndpoint]]],
PlotRange -> {0, 3}
]
}],
{nEndpoint, 3, 300, 1}
]
Any pointers to what's happening?
EDIT: MWE:
pointsDgd3D =
Flatten[Table[{x, y, x*x + y*y}, {x, 0, 2, 0.2}, {y, 0, 2, 0.2}], 1];
pointsDgd3DOpt = RandomChoice[pointsDgd3D, 100];
func = Interpolation[pointsDgd3D];
Manipulate[
Show[{
ListPlot3D[pointsDgd3D],
ListPointPlot3D[
pointsDgd3DOpt[[1 ;; nEndpoint]],
PlotStyle -> {Green, PointSize[0.1]}
]
}],
{nEndpoint, 3, 100, 1}
]
ListPointPlot3D
withDynamic
instead ofpointsDgd3DOpt[[1 ;; nEndpoint]]
? $\endgroup$Import[FileNameJoin[{NotebookDirectory[], "filter_small_space.txt"}], "CSV"]
which uses your own local files. $\endgroup$