Wolfram Research

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]

make 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]

use a mode n bending of the surface.

Details

For pie charts sometimes a little extra space is needed when the values added up exceed the maximum allowed. (i.e. over 100%). When more than 100% is needed, the paper sheet can be bent to create some extra space in the 3rd 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 can not bend without ripping it:

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

Neat Examples (2) 

See how it bends the sheet 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]=

Resource History

Author Notes

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

License Information