lapy.plot¶
Functions for plotting Tet and Tria Meshes with overlays.
For visualizing results in a juypter notebook use this:
.. code-block:: python
import plotly
plotly.offline.init_notebook_mode(connected=True)
...
- lapy.plot.plot_tet_mesh(tetra, vfunc=None, plot_edges=False, plot_levels=False, tfunc=None, cutting=None, edge_color='rgb(50,50,50)', html_output=False, width=800, height=800, flatshading=False, xrange=None, yrange=None, zrange=None, showcaxis=False, caxis=None)[source]¶
Plot tetra meshes.
The tetra mesh will be converted to its tria boundary mesh, and only this will be plotted.
- Parameters:
- tetra
TetMesh Tetrahedral mesh to plot.
- vfunc
np.ndarray, default=None Scalar function at vertices, shape (n_vertices,).
- plot_edges
bool, default=False Whether to plot edges or not.
- plot_levels
bool, default=False Whether to plot levels or not.
- tfunc
np.ndarray, default=None 3D vector function of gradient, shape (n_tetrahedra,) or (n_tetrahedra, 3).
- cutting
strorlistofstr, default=None To view the ‘interior’ of the tetra mesh, one or more cutting criteria can be defined as input arguments to this function: e.g. cutting=(‘x<-10’) or cutting=(‘z>=5’) or cutting=(‘f>4’) where x,y,z represent dimensions 0,1,2 of the vertex array, and f represents the vfunc (which cannot be None if f is used to define a cutting criterion).
- edge_color
str, default=”rgb(50,50,50)” Color of the edges.
- html_output
bool, default=False Whether or not to give out as html output.
- width
int, default=800 Width of the plot (in px).
- height
int, default=800 Height of the plot (in px).
- flatshading
bool, default=False Whether normal smoothing is applied to the meshes or not.
- xrange
listortupleoffloat, default=None Sets the range of the x-axis as [min, max].
- yrange
listortupleoffloat, default=None Sets the range of the y-axis as [min, max].
- zrange
listortupleoffloat, default=None Sets the range of the z-axis as [min, max].
- showcaxis
bool, default=False Whether a colorbar is displayed or not.
- caxis
listortupleoffloat, default=None Sets the bound of the color domain as [lower_bound, upper_bound].
- tetra
- Raises:
ValueErrorIf tetra is not a TetMesh instance, or if vfunc is None when ‘f’ is used in cutting criteria.
- lapy.plot.plot_tria_mesh(tria, vfunc=None, tfunc=None, vcolor=None, tcolor=None, showcaxis=False, caxis=None, xrange=None, yrange=None, zrange=None, plot_edges=False, plot_levels=False, edge_color='rgb(50,50,50)', tic_color='rgb(50,200,10)', background_color=None, flatshading=False, width=800, height=800, camera=None, html_output=False, export_png=None, scale_png=1.0, no_display=False)[source]¶
Plot tria mesh.
- Parameters:
- tria
TriaMesh Triangle mesh to plot.
- vfunc
np.ndarray, default=None Scalar function at vertices, shape (n_vertices,) or (n_vertices, N).
- tfunc
np.ndarray, default=None 3D vector function of gradient, shape (n_triangles,) or (n_triangles, 3).
- vcolor
listofstr, default=None Sets the color of each vertex, shape (n_vertices,).
- tcolor
listofstr, default=None Sets the color of each face, shape (n_triangles,).
- showcaxis
bool, default=False Whether a colorbar is displayed or not.
- caxis
listortupleoffloat, default=None Sets the bound of the color domain as [lower_bound, upper_bound].
- xrange
listortupleoffloat, default=None Sets the range of the x-axis as [min, max].
- yrange
listortupleoffloat, default=None Sets the range of the y-axis as [min, max].
- zrange
listortupleoffloat, default=None Sets the range of the z-axis as [min, max].
- plot_edges
bool, default=False Whether to plot edges or not.
- plot_levels
bool, default=False Whether to plot levels or not.
- edge_color
str, default=”rgb(50,50,50)” Color of the edges.
- tic_color
str, default=”rgb(50,200,10)” Color of the ticks.
- background_color
str, default=None Color of background.
- flatshading
bool, default=False Whether normal smoothing is applied to the meshes or not.
- width
int, default=800 Width of the plot (in px).
- height
int, default=800 Height of the plot (in px).
- camera
dict, default=None Camera dictionary with keys ‘center’, ‘eye’, and ‘up’, each containing a dict with x, y, z coordinates.
- html_output
bool, default=False Whether or not to give out as html output.
- export_png
str, default=None Local file path or file object to write the image to.
- scale_png
float, default=1.0 Scale factor of image. >1.0 increase resolution; <1.0 decrease resolution.
- no_display
bool, default=False Whether to plot on display or not.
- tria
- Raises:
ValueErrorIf tria is not a TriaMesh instance, or if both vfunc/tfunc and vcolor/tcolor are specified, or if both vcolor and tcolor are specified, or if tfunc has invalid dimensions.