# Getting Started¶

This Jupyter notebook demonstrates how a hyperbolic tiling can be constructed and plotted using only very few lines of code.

Import tiling object from hypertiling library

:

from hypertiling import HyperbolicTiling


Set parameters, initialize and generate the tiling

:

p = 7
q = 3
nlayers = 5

T = HyperbolicTiling(p,q,nlayers)
T.generate()


The size of the tiling can be queried like this

:

print("Number of cells:", len(T))

Number of cells: 232


Import and use available script for a quick plot

:

from hypertiling.plot import plot_tiling

:

import matplotlib.cm as cmap
import numpy as np
colors = np.random.rand(len(T))

plot_tiling(T, colors, cmap=cmap.RdBu, edgecolor="k", linewidth=0.12); By default, tilings are centered around a “cell”. They can also be centered around a vertex at the origin, using the following syntax

:

p = 4
q = 5
nlayers = 4

T = HyperbolicTiling(p,q,nlayers, center="vertex")
T.generate()
print("Number of cells:", len(T))

Number of cells: 480

:

plot_tiling??


This example also demonstrates how keyword arguments like “clim” can easily be passed through the plot function

:

plot_tiling(T, np.random.rand(len(T)), cmap=cmap.OrRd, edgecolor="w", lw=0.5, clim=[-1,2]); In the next example we demonstrate how one can easily iterate over the cells of a tiling, e.g. in order to access their attributes

:

T = HyperbolicTiling(7,3,7, center="cell")
T.generate()


Paint cells by number of layer in which they reside

:

colors = []
for t in T:
colors.append(t.layer)

plot_tiling(T, colors, cmap=cmap.GnBu, edgecolor="k", lw=0.2); Finally, something which just looks nice :)

:

T = HyperbolicTiling(3, 12, 4, center="vertex")
T.generate()

:

plot_tiling(T, np.random.rand(len(T)), cmap=cmap.OrRd, edgecolor="w", lw=0.4, clim=[-1,2]); 