Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

So I have a few hundred plots in a grid, that I thought would be nice to adjust the data view with a Dynamic slider. I'm using Jens solution for the Grid plotting here . Manipulating multiple plots in this way would be a great way to compare different portions of complex 3D plots. What I have tried provides only the controls but no plot movement in each part of the grid. Here's the code:

data = {{48.76`, 63.49`, 72.76`, 76.78`, 78.02`, 78.96`, 79.73`, 
80.41`, 81.21`, 81.83`, 82.39`, 83.03`, 83.56`, 84, 84.42`, 
84.53`, 84.69`, 84.74`, 84.55`, 84.73`, 84.56`, 84.47`, 84.31`, 
84.25`, 84.09`, 83.81`, 83.67`, 83.58`, 83.39`, 83.05`, 82.76`, 
82.49`, 82.35`, 82.33`, 82.16`, 82.06`}, {42.08`, 57.42`, 67.24`, 
72.1`, 73.91`, 75.4`, 76.73`, 77.54`, 77.96`, 77.76`, 77.04`, 
75.64`, 74.02`, 72.55`, 71.15`, 70.15`, 70.04`, 69.92`, 69.35`, 
69.21`, 69.33`, 69.99`, 70.29`, 70.17`, 69.92`, 69.77`, 70.09`, 
70.87`, 71.69`, 72.08`, 71.95`, 71.48`, 70.77`, 70.14`, 69.89`, 
70.46`}, {42.03`, 56.78`, 66.37`, 70.92`, 72.63`, 74, 75.27`, 
76.02`, 76.44`, 76.32`, 75.7`, 74.46`, 72.96`, 71.53`, 70.1`, 
69.06`, 68.94`, 68.84`, 68.22`, 68.03`, 68.19`, 68.93`, 69.25`, 
69.12`, 68.84`, 68.71`, 69.1`, 69.89`, 70.76`, 71.15`, 71.03`, 
70.59`, 69.92`, 69.35`, 69.18`, 69.79`}, {39.03`, 53.63`, 63.5`, 
68.37`, 70.26`, 71.8`, 73.19`, 73.93`, 74.24`, 73.92`, 72.91`, 
71.04`, 68.78`, 66.59`, 64.33`, 62.75`, 62.43`, 62.19`, 61.25`, 
60.78`, 61.04`, 62.1`, 62.66`, 62.45`, 62.06`, 61.91`, 62.52`, 
63.73`, 65.08`, 65.81`, 65.78`, 65.28`, 64.36`, 63.57`, 63.44`, 
64.42`}, {31.22`, 46.21`, 57.41`, 63.54`, 66.14`, 68.43`, 70.44`, 
71.39`, 71.38`, 70.37`, 68.2`, 64.36`, 59.76`, 55.23`, 50.36`, 
46.94`, 45.98`, 45.24`, 43.14`, 41.64`, 42.14`, 44.33`, 45.51`, 
45.06`, 44.19`, 44.02`, 45.32`, 47.88`, 50.81`, 52.62`, 52.78`, 
52.06`, 50.5`, 49.01`, 49.26`, 51.58`}, {26.44`, 40.79`, 52.46`, 
59, 61.93`, 64.58`, 66.88`, 67.92`, 67.76`, 66.38`, 63.6`, 58.72`,
 52.92`, 47.21`, 41.06`, 36.78`, 35.48`, 34.49`, 31.86`, 29.83`, 
30.43`, 33.14`, 34.6`, 34.03`, 32.93`, 32.74`, 34.34`, 37.51`, 
41.2`, 43.52`, 43.79`, 42.96`, 41.05`, 39.21`, 39.61`, 
42.46`}, {22.15`, 36.49`, 49.02`, 56.44`, 59.88`, 62.99`, 65.73`, 
66.93`, 66.45`, 64.57`, 60.92`, 54.74`, 47.62`, 40.78`, 33.58`, 
28.71`, 27.21`, 26.08`, 23.15`, 20.89`, 21.54`, 24.47`, 26.08`, 
25.45`, 24.24`, 24.08`, 25.86`, 29.41`, 33.6`, 36.35`, 36.72`, 
35.8`, 33.66`, 31.63`, 32.2`, 35.6`}, {20.01`, 33.94`, 46.53`, 
54.05`, 57.59`, 60.8`, 63.56`, 64.79`, 64.3`, 62.28`, 58.44`, 
51.89`, 44.29`, 36.94`, 29.19`, 23.96`, 22.35`, 21.13`, 18.05`, 
15.69`, 16.37`, 19.42`, 21.11`, 20.41`, 19.13`, 18.95`, 20.8`, 
24.56`, 29.03`, 31.97`, 32.39`, 31.44`, 29.18`, 27.01`, 27.62`, 
31.29`}, {18.84`, 32.74`, 45.29`, 52.81`, 56.47`, 59.72`, 62.63`, 
63.89`, 63.37`, 61.31`, 57.38`, 50.67`, 42.9`, 35.39`, 27.53`, 
22.23`, 20.58`, 19.35`, 16.25`, 13.85`, 14.51`, 17.54`, 19.22`, 
18.53`, 17.25`, 17.06`, 18.91`, 22.67`, 27.19`, 30.17`, 30.61`, 
29.66`, 27.37`, 25.16`, 25.81`, 29.51`}, {18.4`, 32.15`, 45.16`, 
53.05`, 56.88`, 60.39`, 63.55`, 64.83`, 64.16`, 61.86`, 57.5`, 
50.25`, 42.03`, 34.26`, 26.29`, 21.02`, 19.39`, 18.18`, 15.16`, 
12.84`, 13.47`, 16.4`, 18, 17.31`, 16.04`, 15.85`, 17.63`, 21.31`,
 25.79`, 28.79`, 29.22`, 28.25`, 25.92`, 23.72`, 24.38`, 
28.08`}, {17.83`, 31.87`, 44.91`, 53, 56.88`, 60.41`, 63.52`, 
64.85`, 64.22`, 61.88`, 57.5`, 50.17`, 41.77`, 33.79`, 25.52`, 
20.04`, 18.35`, 17.08`, 13.94`, 11.54`, 12.2`, 15.23`, 16.93`, 
16.21`, 14.92`, 14.73`, 16.6`, 20.44`, 25.11`, 28.25`, 28.72`, 
27.72`, 25.33`, 23.07`, 23.77`, 27.65`}, {17.54`, 31.72`, 45.01`, 
53.08`, 57, 60.61`, 63.78`, 65.09`, 64.41`, 62.05`, 57.6`, 50.13`,
 41.53`, 33.28`, 24.72`, 19.04`, 17.29`, 15.99`, 12.78`, 10.36`, 
11.05`, 14.16`, 15.9`, 15.16`, 13.82`, 13.64`, 15.58`, 19.54`, 
24.4`, 27.63`, 28.12`, 27.11`, 24.64`, 22.28`, 23.06`, 
27.08`}, {17.39`, 31.68`, 45.1`, 53.25`, 57.15`, 60.74`, 63.93`, 
65.22`, 64.55`, 62.22`, 57.77`, 50.24`, 41.55`, 33.19`, 24.5`, 
18.73`, 16.96`, 15.64`, 12.41`, 10, 10.71`, 13.83`, 15.58`, 
14.83`, 13.47`, 13.31`, 15.26`, 19.27`, 24.16`, 27.44`, 27.9`, 
26.86`, 24.37`, 22, 22.75`, 26.82`}};

colors = {{0.7287575298024244`, 0.7339864463878705`, 
0.7026006086390431`}, {0.6289819930163401`, 0.6365127030634212`, 
0.6844689735555467`}, {0.6218872719584807`, 0.6291939975325622`, 
0.6746374720508842`}, {0.5730715498598071`, 0.5857318485351554`, 
0.6620239643337804`}, {0.441983024141705`, 0.4759561171496433`, 
0.6487718794019985`}, {0.3606003554322766`, 0.40567334439789926`, 
0.627344738546594`}, {0.29821481618583157`, 0.35028613226131583`, 
0.6207483334714696`}, {0.26170396681489294`, 0.3180653165748131`, 
0.6074454612600748`}, {0.24821850657723366`, 0.3062608953469176`, 
0.6013376700066071`}, {0.23989935134493884`, 0.29818014681271343`,
 0.6066793976522843`}, {0.2312613188553745`, 0.2914238732429747`, 
0.607574894211413`}, {0.22314413852557222`, 0.28475555212948533`, 
0.6097101784633595`}, {0.2204849069272225`, 0.2827947917381827`, 
0.6110365712113156`}};
n = 15;
data = ConstantArray[data, n];
colors = ConstantArray[colors, n];


Manipulate[
 Show[plotGrid[
   Partition[
    Table[ListPlot3D[data[[i]], 
  ColorFunction -> (Blend[RGBColor @@@ colors[[i]], #2] &), 
  BoxStyle -> Directive[Red, Opacity[.5]], Axes -> None, 
  Mesh -> None, BoundaryStyle -> Directive[Black, Thick], 
  PlotLegends -> Automatic], {i, n}], 5], 600, 300], 
  Background -> Black], {{a, 0}, 0, 4 Pi}, {{b, .01}, -Pi, Pi}, 
 ContentSize -> {600, 300}]
share|improve this question
    
This answer includes solution to your problem. Also, take a look at extracting ViewMatrix and links in this Q&A. Simply speaking, you need to set for each plot Option you are interested in with the same Dynamic parameter. –  Kuba Sep 17 '13 at 21:16
1  
I don't like situations when I'm posting the comment and someone else is downvoting :P I feel like it looks it was me and I have not explained why :) –  Kuba Sep 17 '13 at 21:27
    
@Kuba I would like to use Dynamic or Manipulate as is in the code above to rotate all plotted forms. I don't need viewpoints. –  R Hall Sep 17 '13 at 21:28
2  
R Hall, if you had provided a minimal working example of say a grid with two 3d plots that we could all execute on our own, someone could have shown you how to do this very easily. The way the question is written right now it is very unlikely to be of any use in the future, and it makes it harder for you to get help. I'm pretty sure that's why this question got down voted. –  Pickett Sep 17 '13 at 21:33
1  
@RHall I went to that post and copied that code, and then went back and copied your code and I could still not execute it? Neither data nor Color is included, I believe. It's not a minimal example anyhow. –  Pickett Sep 17 '13 at 22:03
show 4 more comments

1 Answer

Using information from the links I've provided in comments and directly copying Slider2D example from Applications section in documentation we can get:

DynamicModule[{p = {2 π, 0}},
 Row[{
      Slider2D[Dynamic[p], {{2 Pi, 0}, {0, Pi}}],
      Show[
       plotGrid[
        Partition[
         Table[
          ListPlot3D[data[[i]], Axes -> None, Mesh -> None, 
            ViewPoint -> Dynamic[4 {Cos[p[[1]]] Sin[p[[2]]], Sin[p[[1]]] Sin[p[[2]]], 
                                    Cos[p[[2]]]}]]
          , {i, n}]
         , 5]
        , 600, 300]
       , Background -> Black]
       }]
       ]

enter image description here enter image description here

I have removed redundant options just for the clarity of the code here. Notice that each one will slow it down a little. Also, I believe you need fast pc to run this with hundreads of plots.

share|improve this answer
    
Looking at the links you posted again, I see that the first link did not have the answer, but contained comments linked to the second link. So I looked for the reason for both posts, since the relationship was only for Dynamic VP. That seemed the logical reason for these two links. If the second link was the only link. It would have made sense and no connection between both links need be made. Thanks for your help and excellent help and answer! –  R Hall Sep 18 '13 at 0:10
    
@RHall You are right. I should have pointed it more precisely. Those links are not the answers but the answer is there :) I'm glad you like it. :) –  Kuba Sep 18 '13 at 7:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.