HighlightMesh[mr,{cellspec1,cellspec2,…}]
highlights the cells specified by cellspeci in the mesh region mr.
HighlightMesh[mr,{…,wj[cellspecj],…}]
highlights using the symbolic wrappers wj.
HighlightMesh
HighlightMesh[mr,{cellspec1,cellspec2,…}]
highlights the cells specified by cellspeci in the mesh region mr.
HighlightMesh[mr,{…,wj[cellspecj],…}]
highlights using the symbolic wrappers wj.
Details and Options
- The cell specification follows the standard form {dim,indexes} and is specifically described in the reference pages for MeshRegion and BoundaryMeshRegion.
- HighlightMesh[mr,{ms1,ms2,…}] returns a new mesh region with the cells specified by msi highlighted.
- The following wrappers can be used:
-
Labeled[cell,…] display the element with labeling Style[cell,spec] show the element using the specified styles - HighlightMesh takes the same options as MeshRegion and BoundaryMeshRegion.
- Styles and other specifications for cells are taken to apply to the highlighted elements celli.
Examples
open all close allBasic Examples (3)
ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]];HighlightMesh[ℛ, 0]ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}]];HighlightMesh[ℛ, 1]ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {Tetrahedron[{1, 2, 3, 4}]}];HighlightMesh[ℛ, {2, 4}]Scope (7)
Specification (4)
HighlightMesh works with MeshRegion:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, 1]ℛ = BoundaryMeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Line[{1, 2, 3, 1}]];HighlightMesh[ℛ, 1]HighlightMesh works on 2D regions:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, 1]ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {Tetrahedron[{1, 2, 3, 4}]}];HighlightMesh[ℛ, 1]HighlightMesh works with points:
ℛ = MeshRegion[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {Tetrahedron[{1, 2, 3, 4}]}];HighlightMesh[ℛ, {0, 4}]HighlightMesh[ℛ, {1, 5}]HighlightMesh[ℛ, {2, 4}]HighlightMesh[ℛ, {1, _ ? EvenQ}]ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, {1, 1}]A collection of cells with the same dimension:
HighlightMesh[ℛ, {1, {1, 2}}]All cells with a given cell dimension:
HighlightMesh[ℛ, 0]HighlightMesh[ℛ, {{0, 1}, {1, 2}}]Multiple collections of cells:
HighlightMesh[ℛ, {{0, {1, 2}}, {1, {2, 3}}}]Styling and Labeling (3)
Specify the highlighting style of a cell:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, Style[1, Red]]Label cells with their indices:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, Labeled[0, "Index"]]Specify an annotation for a highlighted cell:
ℛ = MeshRegion[{{0, 0}, {1, 0}, {1, 1}}, Polygon[{1, 2, 3}]];HighlightMesh[ℛ, Annotation[{1, 3}, MeshCellStyle -> Pink]]Options (11)
MeshCellHighlight (1)
MeshCellHighlight can be used to specify cells to highlight:
HighlightMesh[MeshRegion[{{1, 0}, {2, 1 / 2}, {2, -1 / 2}}, {Triangle[{1, 2, 3}]}], {{1, 1}}, MeshCellHighlight -> {{1, 2} -> Red}]MeshCellLabel (2)
By default, MeshCellLabel of the given region is preserved:
HighlightMesh[[image], {1, {1, 2}}]Use MeshCellLabel->labels to specify labels of highlighted cells:
HighlightMesh[[image], {1, {1, 2}}, MeshCellLabel -> "hello"]MeshCellMarker (2)
By default, MeshCellMarker of the given region is preserved:
BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellMarker -> {1 -> 1}, MeshCellLabel -> {1 -> "Marker"}]HighlightMesh[%, {1, 1}]Use MeshCellMarkermarkers to specify labels of highlighted cells:
BoundaryMeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Line[{1, 2, 3, 1}], MeshCellMarker -> {1 -> 1}, MeshCellLabel -> {1 -> "Marker"}]HighlightMesh[%, {1, 1}, MeshCellMarker -> 2]MeshCellShapeFunction (2)
By default, MeshCellShapeFunction of the given region is preserved:
HighlightMesh[[image], {0, {1, 2}}]Use MeshCellShapeFunctionshapes to specify shape functions of highlighted cells:
HighlightMesh[[image], {0, {1, 2}}, MeshCellShapeFunction -> (Disk[#, .1]&)]MeshCellStyle (2)
MeshCellHighlight is applied after MeshCellStyle:
HighlightMesh[[image], {0, {1, 2}}, MeshCellStyle -> Red]Wrap with Style to style a highlighted cell:
HighlightMesh[[image], Style[{0, {1, 2}}, Red]]PlotTheme (2)
Use a theme with grid lines and a legend:
HighlightMesh[MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Pyramid[{1, 2, 3, 4, 5}]], 1, PlotTheme -> "Detailed"]Use a theme to draw a wireframe:
HighlightMesh[MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, Pyramid[{1, 2, 3, 4, 5}]], {1, 1}, PlotTheme -> "Lines"]Properties & Relations (4)
HighlightMesh of a MeshRegion returns a MeshRegion:
{mr1 = DelaunayMesh[RandomReal[1, {25, 2}]], mr2 = HighlightMesh[mr1, Style[1, Brown]]}{MeshRegionQ[mr1], MeshRegionQ[mr2]}HighlightMesh of a BoundaryMeshRegion returns a BoundaryMeshRegion:
{br1 = ConvexHullMesh[RandomReal[1, {25, 2}]],
br2 = HighlightMesh[br1, Style[1, Brown]]}{BoundaryMeshRegionQ[br1], BoundaryMeshRegionQ[br2]}AnnotationValue can be used to set properties directly:
mr = DelaunayMesh[RandomReal[1, {20, 2}]];
AnnotationValue[{mr, 1}, MeshCellStyle] = Brown;
mrOptions can be used to set properties during the creation of a MeshRegion:
MeshRegion[{{0, 0}, {1, 0}, {0, 1}}, Triangle[{1, 2, 3}], MeshCellLabel -> {{1, 1} -> Red, {1, 2} -> Green, {1, 3} -> Blue}]See Also
Related Guides
Text
Wolfram Research (2014), HighlightMesh, Wolfram Language function, https://reference.wolfram.com/language/ref/HighlightMesh.html (updated 2015).
CMS
Wolfram Language. 2014. "HighlightMesh." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/HighlightMesh.html.
APA
Wolfram Language. (2014). HighlightMesh. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HighlightMesh.html
BibTeX
@misc{reference.wolfram_2026_highlightmesh, author="Wolfram Research", title="{HighlightMesh}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/HighlightMesh.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_highlightmesh, organization={Wolfram Research}, title={HighlightMesh}, year={2015}, url={https://reference.wolfram.com/language/ref/HighlightMesh.html}, note=[Accessed: 12-June-2026]}