0
$\begingroup$

In the output of this code the rectangles and the grid are put between [] and {}. How to get rid of them? I want Manipulate to apply to two objects: the grid and the graphic.

PosH = (1 - pH) (1 - kans);
PosI = pI kans;
NegH = pH (1 - kans);
NegI = (1 - pI) kans;

{{PosH, PosI, PosH + PosI}, {NegH, NegI, NegH + NegI}, {PosH + NegH, 
   PosI + NegI, 1}};
Prepend[%, {"Gezond", "Ziek", ""}];
data = MapThread[Prepend, {%, {"", "Positief", "Negatief", ""}}];

Manipulate[
 Grid[
  {AccountingForm[Grid[%, Frame -> All], {3, 3}]},
  {Graphics[{Red, Rectangle[{0, 0}, {1 - kans, pH}], Blue, 
     Rectangle[{1 - kans, 0}, {1, 1 - pI}], Green, 
     Rectangle[{0, pH}, {1 - kans, 1}], Purple, 
     Rectangle[{1 - kans, 1 - pI}, {1, 1}]}]}
  ],
 {{kans, 0.0001}, 0, 1}, {{pI, 0.99}, 0, 1}, {{pH, 0.99}, 0, 1}]
$\endgroup$
1
$\begingroup$

You can display the grid and graphic together using Column :

Manipulate[Column[{
   AccountingForm[Grid[%, Frame -> All], {3, 3}], 
   Graphics[{Red, Rectangle[{0, 0}, {1 - kans, pH}], Blue, 
     Rectangle[{1 - kans, 0}, {1, 1 - pI}], Green, 
     Rectangle[{0, pH}, {1 - kans, 1}], Purple, 
     Rectangle[{1 - kans, 1 - pI}, {1, 1}]}]
   }],
 {{kans, 0.0001}, 0, 1}, {{pI, 0.99}, 0, 1}, {{pH, 0.99}, 0, 1}]
$\endgroup$
  • $\begingroup$ It's not entirely clear what you're looking for -- perhaps this is it. If not, please clarify what exactly you want the output to be. $\endgroup$ – jjc385 Jul 2 '17 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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