Message Boards Message Boards

GROUPS:

Improve performance of ListPointPlot3D?

Posted 4 years ago
2525 Views
|
0 Replies
|
0 Total Likes
|

Following some excellent advice on this forum, I have created an app where I plot columns to represent the strength and position of lines in difraction spectra for a number of materials

The heart of the code is

f1[l_, lower_, 
  upper_] := (If[
   Length[Select[b[[l]], #[[1]] > lower && #[[1]] < upper &]] > 0, 
   Black, Red])


f[l_, u_] := (
    colarr = f1[#, l, u] &  /@ Range[num];

    ListPointPlot3D[
        res, Filling -> Bottom, ColorFunctionScaling -> False, 
   ColorFunction -> Function[{x, y, z}, colarr[[x]]  ]
              ]   
  )
Manipulate[
 f[ll, uu], {ll, 0, 19.9, Appearance -> "Labeled"}, {uu, .1, 20, 
  Appearance -> "Labeled"}]

b is a list of lists containing the pairs or points where b[[1]] [[1]] gives the position of the line
res is another list derived from b like this

res = {};
Do[  AppendTo[res, Map[Prepend[i], b[[i]]]], {i, num}];

It is a list of triplets giving the 3D points

The idea is if the material has enough points within lower and upper bounds in the y axis it will be a different colour from the points for other materials This works great providing I want to plot a couple of hundred points but it just does not function when I want to plot 2000.

SO MY QUESTION IS :- HOW DO I IMPROVE THE PERFORMANCE?

One thing that I have thought of is that these are not really 2000 independent points. The are rows of points along each value of the x axis. Each row has typically 10 points, all of which will be the same colour. I wondered if I could create a single Line object ( with the 10 vertical lines in) , whose locartion and size would remain absolutely constant, but I would want to change the colour(of the whole Line) as the values of ll and uu were changed in the manipulate.

I am going to experiment with this and maybe this will be even slower. Has anyone got any better ideas?

Thanks

Graham

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