Function Repository Resource:

FractionIndicator

Source Notebook

Visualize fractional values with minimal styling

Contributed by: Michael Sollami

ResourceFunction["FractionIndicator"][frac]

creates a simple display of the fractional value frac.

ResourceFunction["FractionIndicator"][list]

displays the fractional values in the given list.

Details and Options

ResourceFunction["FractionIndicator"] requires nonnegative numbers in the range [0,1].
ResourceFunction["FractionIndicator"] takes two options, ImageSize and "Style". The latter may be set to "Ring", "Pie" or "Bar" (default).
ResourceFunction["FractionIndicator"] depends on the resource function SampleColors.

Examples

Basic Examples (3) 

Display a basic fraction gauge for several values:

In[1]:=
ResourceFunction["FractionIndicator"] /@ Range[0, 1, .2] // TableForm
Out[2]=

Display multiple fractional values:

In[3]:=
ResourceFunction["FractionIndicator"][{.1, .2, .3, .4}, ImageSize -> 100]
Out[3]=

Display fractions in different styles:

In[4]:=
x = .666; Slider[Dynamic[x], {0, 1}]
Out[4]=
In[5]:=
Dynamic[ResourceFunction["FractionIndicator"][x, "Style" -> #] & /@ {"Ring", "Pie", "Bar"}]
Out[5]=

Options (1) 

Display lists of fractional values in different styles as well:

In[6]:=
Manipulate[
 ResourceFunction["FractionIndicator"][{.2, .1, v, .1}, "Style" -> #] & /@ {"Ring", "Pie", "Bar"}, {{v, .1, "Third value:"}, 0, .6, Appearance -> "Labeled"}]
Out[6]=

Possible Issues (1) 

Fractional values must be between 0 and 1:

In[7]:=
ResourceFunction["FractionIndicator"][-.5]
Out[7]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 24 April 2020

Related Resources

License Information