Skip to main content

Style in Graphics or Graphics3D?


To generate a yellow sphere, I usually write the code without using Style:


Graphics3D[{Yellow, Sphere[]}]

However, Style seems to be a more rigorous form in many references:


Graphics3D[Style[Sphere[], Yellow]]


I really seldom use Style even in more complex and lengthy code project. Should I or not?


Please, your suggestions and comments.



Answer



In Graphics and Graphics3D Style behaves mostly as a grouping construct like List. You can use List (instead) for most things, even Options like FontSize or Antialiasing


Graphics3D[{FontSize -> 40, Text["sample"]}]

enter image description here


Graphics[{Circle[{0, 0}, 1], {Antialiasing -> False, Circle[{0, 0}, 0.8]}}]


enter image description here


There are however directives that only work in Style, e.g. styles defined in the style sheets:


Graphics3D[Style[Text["sample"], "Title"]]

enter image description here


Graphics3D[Style[Text["sample"], "TI", 40]]

enter image description here


This is not valid input:


Graphics3D[{"TI", 40, Text["sample"]}]   (* bad input *)

Comments