Function Repository Resource:

OverfullPieChart

Source Notebook

Make a pie chart that exceeds the allowed total

Contributed by: Sander Huisman

ResourceFunction["OverfullPieChart"][{y1,y2,y3,},max]

makes a 3D pie chart of the data yi for which the maximum is max, bending it in 3D to make extra space.

ResourceFunction["OverfullPieChart"][{y1,y2,y3,},max,n]

uses a mode-n bending of the surface.

Details

Sometimes a little extra space is needed in a pie chart when the values added up exceed the maximum allowed (i.e. over 100%). When more than 100% is needed in a pie chart, the paper sheet can be bent to create some extra space in the third dimension.

Examples

Basic Examples (1) 

Make a pie chart for which the total is 140, but the allowed total is only 100:

In[1]:=
ResourceFunction["OverfullPieChart"][{35, 20, 55, 30}, 100]
Out[1]=

Scope (2) 

Without a maximum given, the maximum is assumed to be 1:

In[2]:=
ResourceFunction["OverfullPieChart"][{0.25, 0.45, 0.23, 0.3}]
Out[2]=

Use a higher mode of bending the paper:

In[3]:=
ResourceFunction["OverfullPieChart"][{35, 20, 55, 30}, 100, 8]
Out[3]=

Properties and Relations (1) 

Compare a regular pie chart and an overfull pie chart:

In[4]:=
data = {35, 20, 55, 30};
Row[{PieChart[data, ChartStyle -> ColorData[97] /@ Range[4], SectorOrigin -> {0, "Counterclockwise"}, ImageSize -> 300],
  Show[ResourceFunction["OverfullPieChart"][data, 100], ImageSize -> 300]}]
Out[5]=

Possible Issues (1) 

If the total is less than the maximum, the paper cannot bend without ripping:

In[6]:=
ResourceFunction["OverfullPieChart"][{10, 20, 30}, 100]

Neat Examples (2) 

See how the sheet bends in 3D:

In[7]:=
Show[ResourceFunction["OverfullPieChart"][{0.25, 0.45, 0.23, 0.3}], ViewPoint -> {3.1, -3.71, 1.5}, ViewAngle -> 14 Degree]
Out[7]=

For higher modes, the amplitude is obviously smaller:

In[8]:=
Row[{Show[
   ResourceFunction["OverfullPieChart"][{20, 30, 40, 70}, 100, 5], ViewPoint -> {3, 3, 2}, ViewAngle -> 14 Degree, ImageSize -> 300], Show[ResourceFunction["OverfullPieChart"][{20, 30, 40, 70}, 100, 12], ViewPoint -> {3, 3, 2}, ViewAngle -> 14 Degree, ImageSize -> 300]}]
Out[8]=

Publisher

SHuisman

Version History

  • 1.0.0 – 13 December 2021

Author Notes

Inspired by XKCD comic 2031, where 130% of 'paper' is folded in 3D to make more space.

License Information