Function Repository Resource:

TilingPatternPlot

Source Notebook

Visualize a set of tiles

Contributed by: Wolfram Research

ResourceFunction["TilingPatternPlot"][tiles]

show tiles as a Graphics expression.

Details and Options

A pattern is a rectangular array of positive integer values suitable for use in an ArrayPlot.
A tile mask is a subset of positions within a rectangular array, such as the a values in {{a,a,a},{_,a,_}}. This particular mask is also known as the Tetris T shape.
A tile is an array that can contain integers or blanks.
All tiles in a tileset fit in an array of the same size, say {a,b}. If all subarrays of that size in a larger pattern matches a tile in the tileset, then that tileset can be used to make the given pattern.
An all-zero tile leads to an all white or all zero pattern .
An all-one tile leads to an all black or all one pattern .
The two tiles lead to a checkboard pattern . No subset of the tiles will make a larger pattern, so these two tiles produce a minimal tiling.
The tileset will produce the all-white pattern, but the second tile is not necessary. Therefore, this is not a minimal tileset.
The above patterns have a size of 4×4.
The input tiles should be an array of integer or Blank (_) values.
Consider and {{_,0,0},{0,1,_}}. These both represent a 4-cell tile within a 6-cell array, where the integers indicate the coloring of the tile and the Blank (_) values are wildcards.

Examples

Basic Examples (2) 

Show some tile patterns where the first two could overlap to make the third:

In[1]:=
ResourceFunction[
 "TilingPatternPlot"][{{{_, 0, 0}, {0, 1, _}}, {{_, 0, 1}, {1, 1, _}}, {{_, 0, 0, 1}, {0, 1, 1, _}}}]
Out[1]=

Show a single tile:

In[2]:=
ResourceFunction[
 "TilingPatternPlot"][{{0, 1, 1, 0, 1}, {1, 0, 1, 1, 0}, {1, 1, 0, 1, 1}, {0, 1, 1, 0, 1}, {1, 0, 1, 1, 0}}, ImageSize -> 100]
Out[2]=

Scope (2) 

Multiple colors can be used:

In[3]:=
ResourceFunction[
 "TilingPatternPlot"][{{{1, _, 2}, {3, 4, _}}, {{0, _, 1}, {2, _, 6}}}]
Out[3]=

Use a tile specified as a SparseArray:

In[4]:=
ResourceFunction["TilingPatternPlot"][SparseArray[
 Automatic, {10, 10}, 0, {1, {{0, 6, 13, 20, 26, 33, 40, 46, 53, 60, 66}, {{2}, {3}, {
    5}, {6}, {8}, {9}, {1}, {3}, {4}, {6}, {7}, {9}, {10}, {1}, {2}, {
    4}, {5}, {7}, {8}, {10}, {2}, {3}, {5}, {6}, {8}, {9}, {1}, {3}, {
    4}, {6}, {7}, {9}, {10}, {1}, {2}, {4}, {5}, {7}, {8}, {10}, {
    2}, {3}, {5}, {6}, {8}, {9}, {1}, {3}, {4}, {6}, {7}, {9}, {10}, {
    1}, {2}, {4}, {5}, {7}, {8}, {10}, {2}, {3}, {5}, {6}, {8}, {
    9}}}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}]]
Out[4]=

Neat Examples (1) 

The following 42 tiles are believed to form an aperiodic tiling set equivalent to the minimal Wang tiling set:

In[5]:=
Grid[Partition[ResourceFunction["TilingPatternPlot"][{{{
Blank[], 0, 
Blank[]}, {0, 4, 0}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {2, 4, 2}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {0, 4, 3}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {3, 4, 0}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {3, 4, 1}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {3, 4, 3}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {1, 4, 0}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {1, 4, 1}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {2, 4, 2}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {3, 4, 1}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {1, 4, 3}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {1, 5, 1}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {1, 5, 1}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {1, 5, 2}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {1, 5, 2}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {2, 5, 2}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 0, 
Blank[]}, {2, 5, 2}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {0, 5, 0}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {0, 5, 2}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {1, 5, 2}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {2, 5, 0}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {2, 5, 2}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 1, 
Blank[]}, {2, 5, 2}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {0, 5, 0}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {0, 5, 1}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {1, 5, 0}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {1, 5, 1}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 2, 
Blank[]}, {1, 5, 1}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {2, 5, 1}, {
Blank[], 0, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {2, 5, 2}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {2, 5, 2}, {
Blank[], 2, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {2, 5, 3}, {
Blank[], 1, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {3, 5, 1}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 3, 
Blank[]}, {3, 5, 2}, {
Blank[], 3, 
Blank[]}}, {{
Blank[], 4, 
Blank[]}, {5, 0, 5}, {
Blank[], 4, 
Blank[]}}, {{
Blank[], 5, 
Blank[]}, {4, 0, 4}, {
Blank[], 5, 
Blank[]}}, {{
Blank[], 4, 
Blank[]}, {5, 1, 5}, {
Blank[], 4, 
Blank[]}}, {{
Blank[], 5, 
Blank[]}, {4, 1, 4}, {
Blank[], 5, 
Blank[]}}, {{
Blank[], 4, 
Blank[]}, {5, 2, 5}, {
Blank[], 4, 
Blank[]}}, {{
Blank[], 5, 
Blank[]}, {4, 2, 4}, {
Blank[], 5, 
Blank[]}}, {{
Blank[], 4, 
Blank[]}, {5, 3, 5}, {
Blank[], 4, 
Blank[]}}, {{
Blank[], 5, 
Blank[]}, {4, 3, 4}, {
Blank[], 5, 
Blank[]}}}, ColorRules -> {0 -> White, 1 -> Red, 2 -> Blue, 3 -> Green, 4 -> Black, 5 -> Cyan}, ImageSize -> 50], UpTo[11]]]
Out[5]=

Version History

  • 1.1.0 – 15 March 2022
  • 1.0.0 – 29 November 2021

Related Resources

License Information