Explore the latest version of An Elementary Introduction to the Wolfram Language »
37Layout and Display
Earlier we saw how to use Framed to add a frame when one displays something.
In[1]:=
Click for copyable input
Out[1]=
Specify a background color and a frame style:
In[2]:=
Click for copyable input
Out[2]=
Labeled lets you make things be labeled.
Add a label to the framed number:
In[3]:=
Click for copyable input
Out[3]=
This adds a label to a number styled with a yellow background:
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
You can use Labeled in graphics as well.
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=
Labeled indicates something by putting a label right next to it. Its often nice instead to use callouts, that have little lines pointing to whatever theyre referring to. You can do this by using Callout rather than Labeled.
Callout creates callouts with little lines:
In[9]:=
Click for copyable input
Out[9]=
There are all sorts of ways to annotate graphics. Style directly inserts styling. Tooltip generates interactive tooltips that show themselves when the mouse hovers over them. Legended puts labels into a legend on the side.
In[10]:=
Click for copyable input
Out[10]=
In[11]:=
Click for copyable input
Out[11]=
In[12]:=
Click for copyable input
Out[12]=
In ListPlot, annotations specified by rules are implemented with callouts:
In[13]:=
Click for copyable input
Out[13]=
In PieChart, strings are assumed to be labels, and colors to be styles:
In[14]:=
Click for copyable input
Out[14]=
Display a list of objects in a row:
In[15]:=
Click for copyable input
Out[15]=
Display objects in a column:
In[16]:=
Click for copyable input
Out[16]=
Use GraphicsRow, GraphicsColumn and GraphicsGrid to arrange objects to fit in a certain overall size.
In[17]:=
Click for copyable input
Out[17]=
In[18]:=
Click for copyable input
Out[18]=
37.1Make a list of numbers up to 100, with even numbers on yellow and odd numbers on light gray. »
Expected output:
Out[]=
37.2Make a list of numbers up to 100, with primes framed. »
Expected output:
Out[]=
37.3Make a list of numbers up to 100, with primes framed and labeled in light gray with their values modulo 4. »
Expected output:
Out[]=
37.4Create a 3×6 GraphicsGrid of randomly colored disks. »
Sample expected output:
Out[]=
37.5Make a pie chart of the GDPs of the countries in the G5, labeling each wedge. »
Sample expected output:
Out[]=
37.6Make a pie chart of the populations of the countries in the G5, giving a legend for each wedge. »
Sample expected output:
Out[]=
37.7Make a 5×5 GraphicsGrid of pie charts that give the relative frequencies of digits in 2^n with n starting at 1. »
Expected output:
Out[]=
Sample expected output:
Out[]=
Yes. Use an option like RoundingRadius0.2.
What kinds of things can be in a label?
Anything you want. A label can be text or a graphic or, for that matter, a whole notebook.
Can I use Labeled to put labels in places other than at the bottom?
Yes. Use e.g. Labeled[expr, label, Left] or Labeled[expr, label, Right].
Yes. ListAnimate creates an animation. Constructs from Tooltip to Manipulate can be used to set up dynamic visualizations.
 
Download Notebook Version
es