Skip to main content
added 140 characters in body
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

Just Set dist[[1]] to your output inside Manipulate. Putting additionally a Dynamic to your plots let's you see the change live.

(Edit) You can put your graphics of course inside the same Manipulate and change the graphics too. So after evaluating all your definitions from the first code-block, you could do something like

Column[{Manipulate[
  Manipulate[Column[{
   distToMean[[1]] = (Flatten@
       allTeamAverageStats[[Flatten@
          Position[
           Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                  v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                rosterRASD] & /@ Range[792], 
           Max[Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                 Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                   v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                 rosterRASD] & /@ Range[792]]]]]) - rosterRAMean, {v1,
     Range[.1, 1, .1]}, {v2, Range[.1, 1, .1]}, {v3, 
    Range[.1, 1, .1]}, {v4, Range[.1, 1, .1]}, {v5, 
    Range[.1, 1, .1]}, {v6, Range[.1, 1, .1]}, {v7, 
    Range[.1, 1, .1]}, {v8, Range[.1, 1, .1]}, {v9, 
    Range[.1, 1, .1]}, {v10, Range[.1, 1, .1]}, 
   ControlType -> Manipulator],
  Dynamic[
   Show[Function[attributes, 
      Graphics[{Blend[{{-Max[Abs[distToMean[[1]]]], Red}, {0, 
           LightRed}, {0, LightGreen}, {+Max[Abs[distToMean[[1]]]], 
           Green}}, distToMean[[1]][[attributes]]], 
        Rectangle[{If[distToMean[[1]][[attributes]] < 0, 
           distToMean[[1]][[attributes]]*10, 0], 
          attributes - 1}, {If[distToMean[[1]][[attributes]] < 0, 0, 
           distToMean[[1]][[attributes]]*10], attributes}], 
        PlotRange -> {{-6, 6}, {0, 10}}}, AspectRatio -> 16/9, 
       Epilog -> {Black, Thickness[.05]Thickness[thickness], 
         Line[{{0, 0}, {0, 11}}]}]] /@
      Range[10], Frame -> False, 
    FrameTicks -> False]]False]
   }, Center
  ],
 
 {v1, Range[.1, 1, .1]}, {v2, Range[.1, 1, .1]}, {v3, 
  Range[.1, 1, .1]}, {v4, Range[.1, 1, .1]}, {v5, 
  Range[.1, 1, .1]}, {v6, Range[.1, 1, .1]}, {v7, 
  Range[.1, 1, .1]}, {v8, Range[.1, 1, .1]}, {v9, 
  Range[.1, 1, .1]}, {v10, Range[.1, 1, .1]}, {thickness, 0.01, 0.1}, 
 ControlType -> Manipulator]

Just Set dist[[1]] to your output inside Manipulate. Putting additionally a Dynamic to your plots let's you see the change live. So after evaluating all your definitions from the first code-block, you could do something like

Column[{
  Manipulate[
   distToMean[[1]] = (Flatten@
       allTeamAverageStats[[Flatten@
          Position[
           Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                  v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                rosterRASD] & /@ Range[792], 
           Max[Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                 Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                   v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                 rosterRASD] & /@ Range[792]]]]]) - rosterRAMean, {v1,
     Range[.1, 1, .1]}, {v2, Range[.1, 1, .1]}, {v3, 
    Range[.1, 1, .1]}, {v4, Range[.1, 1, .1]}, {v5, 
    Range[.1, 1, .1]}, {v6, Range[.1, 1, .1]}, {v7, 
    Range[.1, 1, .1]}, {v8, Range[.1, 1, .1]}, {v9, 
    Range[.1, 1, .1]}, {v10, Range[.1, 1, .1]}, 
   ControlType -> Manipulator],
  Dynamic[
   Show[Function[attributes, 
      Graphics[{Blend[{{-Max[Abs[distToMean[[1]]]], Red}, {0, 
           LightRed}, {0, LightGreen}, {+Max[Abs[distToMean[[1]]]], 
           Green}}, distToMean[[1]][[attributes]]], 
        Rectangle[{If[distToMean[[1]][[attributes]] < 0, 
           distToMean[[1]][[attributes]]*10, 0], 
          attributes - 1}, {If[distToMean[[1]][[attributes]] < 0, 0, 
           distToMean[[1]][[attributes]]*10], attributes}], 
        PlotRange -> {{-6, 6}, {0, 10}}}, AspectRatio -> 16/9, 
       Epilog -> {Black, Thickness[.05], Line[{{0, 0}, {0, 11}}]}]] /@
      Range[10], Frame -> False, FrameTicks -> False]]
  }]

Just Set dist[[1]] to your output inside Manipulate. Putting additionally a Dynamic to your plots let's you see the change live.

(Edit) You can put your graphics of course inside the same Manipulate and change the graphics too. So after evaluating all your definitions from the first code-block, you could do something like

Manipulate[
 Column[{
   distToMean[[1]] = (Flatten@
       allTeamAverageStats[[Flatten@
          Position[
           Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                  v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                rosterRASD] & /@ Range[792], 
           Max[Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                 Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                   v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                 rosterRASD] & /@ Range[792]]]]]) - rosterRAMean,
   Show[Function[attributes, 
      Graphics[{Blend[{{-Max[Abs[distToMean[[1]]]], Red}, {0, 
           LightRed}, {0, LightGreen}, {+Max[Abs[distToMean[[1]]]], 
           Green}}, distToMean[[1]][[attributes]]], 
        Rectangle[{If[distToMean[[1]][[attributes]] < 0, 
           distToMean[[1]][[attributes]]*10, 0], 
          attributes - 1}, {If[distToMean[[1]][[attributes]] < 0, 0, 
           distToMean[[1]][[attributes]]*10], attributes}], 
        PlotRange -> {{-6, 6}, {0, 10}}}, AspectRatio -> 16/9, 
       Epilog -> {Black, Thickness[thickness], 
         Line[{{0, 0}, {0, 11}}]}]] /@ Range[10], Frame -> False, 
    FrameTicks -> False]
   }, Center
  ],
 
 {v1, Range[.1, 1, .1]}, {v2, Range[.1, 1, .1]}, {v3, 
  Range[.1, 1, .1]}, {v4, Range[.1, 1, .1]}, {v5, 
  Range[.1, 1, .1]}, {v6, Range[.1, 1, .1]}, {v7, 
  Range[.1, 1, .1]}, {v8, Range[.1, 1, .1]}, {v9, 
  Range[.1, 1, .1]}, {v10, Range[.1, 1, .1]}, {thickness, 0.01, 0.1}, 
 ControlType -> Manipulator]
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

Just Set dist[[1]] to your output inside Manipulate. Putting additionally a Dynamic to your plots let's you see the change live. So after evaluating all your definitions from the first code-block, you could do something like

Column[{
  Manipulate[
   distToMean[[1]] = (Flatten@
       allTeamAverageStats[[Flatten@
          Position[
           Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                  v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                rosterRASD] & /@ Range[792], 
           Max[Total[{v1, v2, v3, v4, v5, v6, v7, v8, v9, v10}/
                 Total@{v1, v2, v3, v4, v5, v6, v7, v8, v9, 
                   v10} (allTeamAverageStats[[#]] - rosterRAMean)/
                 rosterRASD] & /@ Range[792]]]]]) - rosterRAMean, {v1,
     Range[.1, 1, .1]}, {v2, Range[.1, 1, .1]}, {v3, 
    Range[.1, 1, .1]}, {v4, Range[.1, 1, .1]}, {v5, 
    Range[.1, 1, .1]}, {v6, Range[.1, 1, .1]}, {v7, 
    Range[.1, 1, .1]}, {v8, Range[.1, 1, .1]}, {v9, 
    Range[.1, 1, .1]}, {v10, Range[.1, 1, .1]}, 
   ControlType -> Manipulator],
  Dynamic[
   Show[Function[attributes, 
      Graphics[{Blend[{{-Max[Abs[distToMean[[1]]]], Red}, {0, 
           LightRed}, {0, LightGreen}, {+Max[Abs[distToMean[[1]]]], 
           Green}}, distToMean[[1]][[attributes]]], 
        Rectangle[{If[distToMean[[1]][[attributes]] < 0, 
           distToMean[[1]][[attributes]]*10, 0], 
          attributes - 1}, {If[distToMean[[1]][[attributes]] < 0, 0, 
           distToMean[[1]][[attributes]]*10], attributes}], 
        PlotRange -> {{-6, 6}, {0, 10}}}, AspectRatio -> 16/9, 
       Epilog -> {Black, Thickness[.05], Line[{{0, 0}, {0, 11}}]}]] /@
      Range[10], Frame -> False, FrameTicks -> False]]
  }]

Note: This is far from being good programming style but for a test it should be fine.