Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control Placement using Manipulate in Mathematica

I would like to have the Pink & Green CheckBox Control to be displayed on a single line. Despite extensive look on the ControlPlacement Help, I cannot adapt it to make it work.

Manipulate[
Graphics[{If[thePink, {Pink, Disk[{5, 5}, r]}], 
If[theGreen, {Green, Disk[{4, 2}, r]}]}, 
PlotRange -> {{0, 20}, {0, 10}}], {{r, 1, 
Style["Radius", Black, Bold, 12]}, 1, 5, 1, ControlType -> Setter, 
ControlPlacement -> Top}, {{thePink, True, 
Style["Pink", Black, Bold, 12]}, {True, False}}, {{theGreen, False,
Style["Green", Black, Bold, 12]}, {True, False}}]

enter image description here

like image 726
500 Avatar asked Jun 09 '11 20:06

500


People also ask

What is the use of manipulate command in Mathematica?

Just like Table, Manipulate allows you to give more than one variable range specification. You can have as many variables as you like, including so many that a similar Table command would try to enumerate an unreasonably large number of entries.

What is module in Mathematica?

Module allows you to set up local variables with names that are local to the module. Module creates new symbols to represent each of its local variables every time it is called. Module creates a symbol with name xxx$nnn to represent a local variable with name xxx.


1 Answers

Use Row[ ] and Control[ ]:

Manipulate[Graphics[{If[thePink, {Pink, Disk[{5, 5}, r]}],
   If[theGreen, {Green, Disk[{4, 2}, r]}]}, PlotRange -> {{0, 20}, {0, 10}}], 
   {{r, 1, Style["Radius", Black, Bold, 12]}, 1, 5, 1, ControlType -> Setter, 
                                                     ControlPlacement -> Top},
 Row[
  {Control@{{thePink, True, Style["Pink", Black, Bold, 12]}, {True, False}}, 
   Spacer[20], 
   Control@{{theGreen, False, Style["Green", Black, Bold, 12]}, {True,False}}}]]

enter image description here

like image 135
Dr. belisarius Avatar answered Sep 30 '22 09:09

Dr. belisarius