Description Usage Arguments Format Details Value See Also Examples

`pattern_hex()`

returns an integer matrix indicating where each
color (or other graphical element) should be drawn on a (horizontal) hex grid
for a specified hex pattern type and subtype.
`names_hex`

lists the currently supported hex `type`

s.

1 2 3 |

`type` |
Currently just supports "hex". |

`subtype` |
An integer indicating number of colors (or other graphical elements). |

`nrow` |
Number of rows (height). |

`ncol` |
Number of columns (width). |

An object of class `character`

of length 5.

- "hex"
Attempts to use a uniform coloring if it exists. For subtype

`1L`

,`2L`

, and`3L`

we use the "hex1" pattern. For subtype`4L`

we use the "hex2" pattern. For subtype`7L`

we use the "hex3" pattern. Else a uniform coloring does not exist and we use the "hex_skew" pattern.- "hex1"
Provides the 1-uniform colorings of a hexagonal tiling. Only exists for

`subtype`

`1L`

,`2L`

, or`3L`

.- "hex2"
Provides the 2-uniform colorings of a hexagonal tiling. Only exists for

`subtype`

`2L`

or`4L`

.- "hex3"
Provides the 3-uniform colorings of a hexagonal tiling. Only exists for

`subtype`

`2L`

or`7L`

.- "hex_skew"
For the "hex_skew"

`type`

we cycle through`subtype`

elements on the horizontal line and "main" diagonal line. For some`subtype`

numbers this may lead to noticeable color repeats on the "skew" diagonal line. If`subtype`

is strictly greater than`2L`

then a hexagon should never touch another hexagon of the same color.

A matrix of integer values indicating where the each color
or other graphical elements should be drawn on a horizontal hex grid
(i.e. hexagons are assumed to be pointy side up).
Indices `[1,1]`

of the matrix corresponds to the bottom-left of the grid
while indices `[1,ncol]`

corresponds to the bottom-right of the grid.
The even rows are assumed to be on the **left** of the ones on the odd rows
(for those in the same column in the matrix).
This matrix has a "pattern_hex" subclass which supports a special `print()`

method.

`grid.pattern_regular_polygon()`

for drawing to a graphics device
hexagons, triangles, circles, etc. in hexagon patterns.
The tiling vignette features several examples of regular polygon tiling using
this both the "hex" and "hex_circle" types `vignette("tiling", package = "gridpattern")`

.
For more information on uniform colorings of a hexagonal tiling see
https://en.wikipedia.org/wiki/Hexagonal_tiling#Uniform_colorings.

1 2 3 4 5 6 7 8 9 10 | ```
# supported hex names
print(names_hex)
# 1-uniform 3-color
hex_3color <- pattern_hex("hex1", 3L, nrow = 7L, ncol = 9L)
print(hex_3color)
# 2-uniform 4-color
hex_4color <- pattern_hex("hex2", 4L, nrow = 7L, ncol = 9L)
print(hex_4color)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.