Function Repository Resource:

FractionPieChart

Source Notebook

Visualize fractions and mixed numbers using pie charts

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["FractionPieChart"][n/d]

creates a pie chart or row of pie charts representing the fraction n/d.

ResourceFunction["FractionPieChart"][n]

creates a pie chart or row of pie charts representing the integer n.

ResourceFunction["FractionPieChart"][n1/d1 + n2/d2 + ]

creates a row of pie charts representing the addition of the fractions n1/d1,n2/d2,.

Details and Options

ResourceFunction["FractionPieChart"] accepts inputs greater than 1/50 and less than 50.
ResourceFunction["FractionPieChart"] has the same options as Graphics, with the following additions:
FillingStylesets the color for the filled parts of the pie charts
"PieColor"sets the color for the unfilled parts of the pie charts
"ShowAddition"Automaticdetermines whether to show plus signs between pie charts
FontColorsets the color of the plus signs between pie charts
“PlusFontSize"Automaticsets the size of the plus signs between pie charts
"UnitLabels"Automaticsets the text of the label displayed in the sections of the pie charts
ResourceFunction["FractionPieChart"] has the attributes HoldAll and Listable.

Examples

Basic Examples (3) 

Get a pie chart representing the fraction 4/5:

In[1]:=
ResourceFunction["FractionPieChart"][4/5]
Out[1]=

Get a row of pie charts representing the fraction 8/3:

In[2]:=
ResourceFunction["FractionPieChart"][8/3]
Out[2]=

Get a row of pie charts representing the addition 1/3 + 3/4 + 5/30:

In[3]:=
ResourceFunction["FractionPieChart"][1/3 + 3/4 + 5/30]
Out[3]=

Scope (1) 

Use FractionPieChart to visually compare the mixed number and improper fraction forms of a number:

In[4]:=
ResourceFunction["FractionPieChart"][2 + 2/3]
Out[4]=
In[5]:=
ResourceFunction["FractionPieChart"][8/3]
Out[5]=

Options (11) 

FillingStyle (2) 

Use the FillingStyle option to set the color of the filled sections of the pie charts:

In[6]:=
ResourceFunction["FractionPieChart"][9/4, FillingStyle -> LightPurple]
Out[6]=

For addition of multiple fractions, FillingStyle can be a list of colors:

In[7]:=
ResourceFunction["FractionPieChart"][1/2 + 2/3 + 3/4, FillingStyle -> {Red, Yellow, Blue}]
Out[7]=

PieColor (1) 

Use the "PieColor" option to set the color of the unfilled sections of the pie charts:

In[8]:=
ResourceFunction["FractionPieChart"][6/18, "PieColor" -> LightCyan, FillingStyle -> Cyan]
Out[8]=

ShowAddition (2) 

Set the "ShowAddition" to False to hide the plus signs between multiple pie charts:

In[9]:=
ResourceFunction["FractionPieChart"][9/4, "ShowAddition" -> False]
Out[9]=

For large numbers of pie charts, the plus signs are automatically hidden. Set the "ShowAddition" option to True to force addition symbols:

In[10]:=
ResourceFunction["FractionPieChart"][48/5, "ShowAddition" -> True]
Out[10]=

FontColor (2) 

Use the FontColor option to set the color of the plus signs between pie charts:

In[11]:=
ResourceFunction["FractionPieChart"][3/5 + 1/5 + 4/5, FontColor -> Purple]
Out[11]=

To change the color of the labels font, use the LabelStyle option:

In[12]:=
ResourceFunction["FractionPieChart"][3/5, LabelStyle -> Purple]
Out[12]=

PlusFontSize (1) 

Use the "PlusFontSize" option to set the size of the plus signs between pie charts:

In[13]:=
ResourceFunction["FractionPieChart"][30/12, "ShowAddition" -> True, "PlusFontSize" -> 72]
Out[13]=

UnitLabels (3) 

Unit labels are automatically hidden for small sectors:

In[14]:=
ResourceFunction["FractionPieChart"][3/25]
Out[14]=

Force showing unit labels by setting the "UnitLabels" option to True:

In[15]:=
ResourceFunction["FractionPieChart"][3/25, "UnitLabels" -> True]
Out[15]=

Customize the unit labels via the "UnitLabels" option:

In[16]:=
ResourceFunction["FractionPieChart"][10/4, "UnitLabels" -> "fourth"]
Out[16]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 28 March 2022

Related Resources

Author Notes

To view the full source code for FractionPieChart, evaluate the following:

In[1]:=
SystemOpen[
 FileNameJoin[{DirectoryName[FindFile["ResourceFunctionHelpers`"]], "NumberDiagrams.wl"}]]

License Information