API Reference

dewloosh.plotly.d2.plot_triangles_2d(points, data=None) Figure[source]

Plots a triangulation with attached field data.

Parameters:
Returns:

figure – The figure object.

Return type:

go.Figure

Example

>>> from polymesh.grid import grid
>>> from polymesh.topo.tr import Q4_to_T3
>>> from dewloosh.plotly import plot_triangles_2d
>>> import numpy as np
>>> 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')
>>> plot_triangles_2d(points, np.random.rand(len(points)))
dewloosh.plotly.d2.plot_triangles_3d(points, triangles, data=None, plot_edges=True, edges=None) Figure[source]

Plots a triangulation with attached field data in 3d.

Parameters:
  • points (numpy.ndarray) – 2d float array of points.

  • data (numpy.ndarray) – 1d float array of scalar data over the points.

  • plot_edges (bool, Optional) – If True, plots the edges of the mesh. Default is False.

  • edges (numpy.ndarray, Optional) – The edges to plot, only if plot_edges is True.

Returns:

figure – The figure object.

Return type:

go.Figure