Plotting
The nanomesh.plotting
module helps with plotting meshes.
Functions
These plotting functions are currently available:
|
Plot a |
|
Alias for |
|
Alias for |
|
Plot line/triangle mesh together. |
|
Plot collection of line segments. |
|
Plot mesh points. |
Reference
- nanomesh.plotting.meshplot(mesh: LineMesh | TriangleMesh, ax: plt.Axes = None, key: str = None, legend: str = 'fields', show_labels: Optional[Iterable | str | int] = None, hide_labels: Optional[Iterable | str | int] = None, show_region_markers: bool = True, colors: Sequence[str] = None, color_map: Dict[str | int, str] = None, flip_xy: bool = True, **kwargs) plt.Axes [source]
Plot a
nanomesh.TriangleMesh
ornanomesh.LineMesh
usingmatplotlib
.- Parameters
ax (matplotlib.axes.Axes, optional) – Axes to use for plotting.
key (str, optional) – Label of cell data item to plot, defaults to
nanomesh.LineMesh.default_key
ornanomesh.TriangleMEsh.default_key
.legend (str) – Style for the legend. - off : No legend - all : Create legend with all labels - fields : Create legend with field names only - floating : Add floating labels to plot
show_labels (Iterable | str | int) – List of labels or field names of cell data to show. A single label to show can also be specified directly by its name or number.
hide_labels (Iterable | str | int) – List of labels or field names of cell data to hide. A single label to hide can also be specified directly by its name or number.
show_region_markers (bool, default True) – If True, show region markers on the plot
colors (Sequence[str]) – List of colors to cycle through
color_map (dict) – Mapping of labels or field names to colors.
flip_xy (bool, optional) – Flip x/y coordinates. This is sometimes necessary to combine the plot with other plots.
**kwargs – These parameters are passed to
lineplot()
ortriplot()
.
- Return type
- nanomesh.plotting.linemeshplot(mesh: LineMesh | TriangleMesh, ax: plt.Axes = None, key: str = None, legend: str = 'fields', show_labels: Optional[Iterable | str | int] = None, hide_labels: Optional[Iterable | str | int] = None, show_region_markers: bool = True, colors: Sequence[str] = None, color_map: Dict[str | int, str] = None, flip_xy: bool = True, **kwargs) plt.Axes
Alias for
meshplot()
.
- nanomesh.plotting.trianglemeshplot(mesh: LineMesh | TriangleMesh, ax: plt.Axes = None, key: str = None, legend: str = 'fields', show_labels: Optional[Iterable | str | int] = None, hide_labels: Optional[Iterable | str | int] = None, show_region_markers: bool = True, colors: Sequence[str] = None, color_map: Dict[str | int, str] = None, flip_xy: bool = True, **kwargs) plt.Axes
Alias for
meshplot()
.
- nanomesh.plotting.linetrianglemeshplot(mesh: MeshContainer, **kwargs) Tuple[plt.Axes, plt.Axes] [source]
Plot line/triangle mesh together.
- Parameters
mesh (MeshContainer) – Input mesh containing line and triangle cells.
**kwargs – Extra keyword arguments passed to -
linemeshplot()
-trianglemeshplot()
- Returns
Tuple of matplotlib axes
- Return type
- nanomesh.plotting.lineplot(ax: Axes, *, x: ndarray, y: ndarray, cells: ndarray, mask: Optional[ndarray] = None, label: Optional[str] = None, **kwargs)[source]
Plot collection of line segments.
API mimicks
triplot()
.- Parameters
ax (matplotlib.axes.Axes) – Description
x ((n, 1) numpy.ndarray) – x-coordinates of points.
y ((n, 1) numpy.ndarray) – y-coordinates of points.
cells ((m, 3) numpy.ndarray) – Integer array describing the line segments.
mask ((m, 1) numpy.ndarray, optional) – Mask for line segments.
label (str, optional) – Label for legend.
**kwargs – Extra keywords arguments passed to
matplotlib.pyplot.plot()
- Returns
A list of lines representing the line segments and nodes.
- Return type
list of
matplotlib.lines.Line2D
- nanomesh.plotting.pointsplot(mesh: MeshContainer, key: str = None, ax: plt.Axes = None, **kwargs) plt.Axes [source]
Plot mesh points.
- Parameters
mesh (MeshContainer) – Input mesh
key (str, optional) – Key of the point data to use for coloring
ax (matplotlib.axes.Axes, optional) – Axes to use for plotting.
**kwargs – These parameters are passed to
matplotlib.pyplot.scatter()
- Return type