This page was generated from
docs/source/examples/triplot_hinton.ipynb.
Triangular hinton diagram#
This kind of plot builds on the idea of Hinton diagrams, originally mentioned by David Warde-Farley in the SciPy Cookbook, but extends it to triangular plots.
[1]:
import numpy as np
from sigmaepsilon.mesh.grid import grid
from sigmaepsilon.mesh.utils.topology.tr import Q4_to_T3
from sigmaepsilon.mesh.trimesh import triangulate
from sigmaepsilon.plotting.mpl import triplot
gridparams = {
'size' : (1200, 600),
'shape' : (30, 15),
'eshape' : (2, 2),
'origo' : (0, 0),
'start' : 0
}
coordsQ4, topoQ4 = grid(**gridparams)
points, triangles = Q4_to_T3(coordsQ4, topoQ4, path='grid')
triobj = triangulate(points=points[:, :2], triangles=triangles)[-1]
data = np.random.rand(len(triangles))
triplot(triobj, hinton=True, data=data)
[1]:
[<sigmaepsilon.plotting.mpl.triplot.TriPatchCollection at 0x1c384727e80>]