class_docstr: An unstructured triangular grid consisting of npoints points and
  ntri triangles.  The triangles can either be specified by the user
  or automatically generated using a Delaunay triangulation.
  
  Parameters
  ----------
  x, y : (npoints,) array-like
      Coordinates of grid points.
  triangles : (ntri, 3) array-like of int, optional
      For each triangle, the indices of the three points that make
      up the triangle, ordered in an anticlockwise manner.  If not
      specified, the Delaunay triangulation is calculated.
  mask : (ntri,) array-like of bool, optional
      Which triangles are masked out.
  
  Attributes
  ----------
  triangles : (ntri, 3) array of int
      For each triangle, the indices of the three points that make
      up the triangle, ordered in an anticlockwise manner. If you want to
      take the *mask* into account, use `get_masked_triangles` instead.
  mask : (ntri, 3) array of bool or None
      Masked out triangles.
  is_delaunay : bool
      Whether the Triangulation is a calculated Delaunay
      triangulation (where *triangles* was not specified) or not.
  
  Notes
  -----
  For a Triangulation to be valid it must not have duplicate points,
  triangles formed from colinear points, or overlapping triangles.
class_docstr_tok: ["An","unstructured","triangular","grid","consisting","of","npoints","points","and","ntri","triangles",".","The","triangles","can","either","be","specified","by","the","user","or","automatically","generated","using","a","Delaunay","triangulation",".","Parameters","--","--","--","--","--","x",",","y",":","(","npoints",",",")","array-like","Coordinates","of","grid","points",".","triangles",":","(","ntri",",","3",")","array-like","of","int",",","optional","For","each","triangle",",","the","indices","of","the","three","points","that","make","up","the","triangle",",","ordered","in","an","anticlockwise","manner",".","If","not","specified",",","the","Delaunay","triangulation","is","calculated",".","mask",":","(","ntri",",",")","array-like","of","bool",",","optional","Which","triangles","are","masked","out",".","Attributes","--","--","--","--","--","triangles",":","(","ntri",",","3",")","array","of","int","For","each","triangle",",","the","indices","of","the","three","points","that","make","up","the","triangle",",","ordered","in","an","anticlockwise","manner",".","If","you","want","to","take","the","*","mask","*","into","account",",","use","`","get_masked_triangles","`","instead",".","mask",":","(","ntri",",","3",")","array","of","bool","or","None","Masked","out","triangles",".","is_delaunay",":","bool","Whether","the","Triangulation","is","a","calculated","Delaunay","triangulation","(","where","*","triangles","*","was","not","specified",")","or","not",".","Notes","--","--","-","For","a","Triangulation","to","be","valid","it","must","not","have","duplicate","points",",","triangles","formed","from","colinear","points",",","or","overlapping","triangles","."]
docstr: Set or clear the mask array.
  
  Parameters
  ----------
  mask : None or bool array of length ntri
docstr_tok: ["Set","or","clear","the","mask","array",".","Parameters","--","--","--","--","--","mask",":","None","or","bool","array","of","length","ntri"]
code: def set_mask(self, mask):
      """
      Set or clear the mask array.
  
      Parameters
      ----------
      mask : None or bool array of length ntri
      """
      if mask is None:
          self.mask = None
      else:
          self.mask = np.asarray(mask, dtype=bool)
          if self.mask.shape != (self.triangles.shape[0],):
              raise ValueError(
                  "mask array must have same length as "
                  "triangles array"
              )
  
      # Set mask in C++ Triangulation.
      if self._cpp_triangulation is not None:
          self._cpp_triangulation.set_mask(
              self.mask if self.mask is not None else ()
          )
  
      # Clear derived fields so they are recalculated when needed.
      self._edges = None
      self._neighbors = None
  
      # Recalculate TriFinder if it exists.
      if self._trifinder is not None:
          self._trifinder._initialize()
  
file_path: matplotlib/lib/matplotlib/tri/_triangulation.py
imports: import sys
  import numpy
  from matplotlib import _api
label_desc: Use image node_id 10 for calling the Triangulation obj's underlying member method code with example usage: obj.set_mask(mask) without return types