Wolfram Computation Meets Knowledge

RaggedDigitsPlot

Contributed by: Stephen Wolfram

Plot an array of digits, allowing them to be ragged on the left.

ResourceFunction["RaggedDigitsPlot"][list]

plots the list of binary digit sequences in list, showing them as ragged on the left.

ResourceFunction["RaggedDigitsPlot"][list, b]

assumes digits in base b.

ResourceFunction["RaggedDigitsPlot"][list, b, n]

uses n digits of padding on the left.

Details and Options

Used in A New Kind of Science, page 560 (section 10.4).
Supports ColorData, ColorRules, Mesh, MeshStyle and options of Graphics.
Mesh takes values True or False.

Examples

Basic Examples

Plot binary digit sequences of successive numbers:

In[1]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}]]
Out[1]=

Plot ternary digit sequences:

In[2]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 3], {n, 10}], 3]
Out[2]=

Include padding equivalent to 3 digits positions on the left:

In[3]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3]
Out[3]=

Options

Hide Mesh:

In[4]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, ColorFunction -> GrayLevel, Mesh -> False]
Out[4]=

Select color maps:

In[5]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, ColorFunction -> ColorData["BrightBands"], Mesh -> True]
Out[5]=
In[6]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, ColorFunction -> ColorData[{"TemperatureMap", "Reverse"}], Mesh -> True]
Out[6]=
In[7]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, ColorFunction -> ColorData["HTML"], Mesh -> False]
Out[7]=

Specify individual colors for values:

In[8]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 3], {n, 20}], 3, ColorRules -> {0 -> Red, 1 -> Blue, 2 -> Yellow}]
Out[8]=
In[9]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, ColorRules -> {0 -> Blue}]
Out[9]=

Add other options:

In[10]:=
ResourceFunction["RaggedDigitsPlot"][
 Table[IntegerDigits[n, 2], {n, 20}], 2, 3, Background -> LightBlue, ColorFunction -> ColorData["WebSafe"], MeshStyle -> Directive[Blue, Opacity[0.4], Thickness[.02]], Frame -> True, PlotLabel -> "Digits", PlotRangePadding -> 1]
Out[10]=

Resource History