class_docstr: An abstract canvas representing the space in which to bin.
  
  Parameters
  ----------
  plot_width, plot_height : int, optional
      Width and height of the output aggregate in pixels.
  x_range, y_range : tuple, optional
      A tuple representing the bounds inclusive space ``[min, max]`` along
      the axis.
  x_axis_type, y_axis_type : str, optional
      The type of the axis. Valid options are ``'linear'`` [default], and
      ``'log'``.
class_docstr_tok: ["An","abstract","canvas","representing","the","space","in","which","to","bin",".","Parameters","--","--","--","--","--","plot_width",",","plot_height",":","int",",","optional","Width","and","height","of","the","output","aggregate","in","pixels",".","x_range",",","y_range",":","tuple",",","optional","A","tuple","representing","the","bounds","inclusive","space","``","[","min",",","max","]","``","along","the","axis",".","x_axis_type",",","y_axis_type",":","str",",","optional","The","type","of","the","axis",".","Valid","options","are","``","'linear","'","``","[","default","]",",","and","``","'log","'","``","."]
docstr: Compute a reduction by pixel, mapping data to pixels as a triangle.
  
  >>> import datashader as ds
  >>> verts = pd.DataFrame({'x': [0, 5, 10],
  ...                         'y': [0, 10, 0],
  ...                         'weight': [1, 5, 3]},
  ...                        columns=['x', 'y', 'weight'])
  >>> tris = pd.DataFrame({'v0': [2], 'v1': [0], 'v2': [1]},
  ...                       columns=['v0', 'v1', 'v2'])
  >>> cvs = ds.Canvas(x_range=(verts.x.min(), verts.x.max()),
  ...                 y_range=(verts.y.min(), verts.y.max()))
  >>> untested = cvs.trimesh(verts, tris)
  
  Parameters
  ----------
  vertices : pandas.DataFrame, dask.DataFrame
      The input datasource for triangle vertex coordinates. These can be
      interpreted as the x/y coordinates of the vertices, with optional
      weights for value interpolation. Columns should be ordered
      corresponding to 'x', 'y', followed by zero or more (optional)
      columns containing vertex values. The rows need not be ordered.
      The column data types must be floating point or integer.
  simplices : pandas.DataFrame, dask.DataFrame
      The input datasource for triangle (simplex) definitions. These can
      be interpreted as rows of ``vertices``, aka positions in the
      ``vertices`` index. Columns should be ordered corresponding to
      'vertex0', 'vertex1', and 'vertex2'. Order of the vertices can be
      clockwise or counter-clockwise; it does not matter as long as the
      data is consistent for all simplices in the dataframe. The
      rows need not be ordered.  The data type for the first
      three columns in the dataframe must be integer.
  agg : Reduction, optional
      Reduction to compute. Default is ``mean()``.
  mesh : pandas.DataFrame, optional
      An ordered triangle mesh in tabular form, used for optimization
      purposes. This dataframe is expected to have come from
      ``datashader.utils.mesh()``. If this argument is not None, the first
      two arguments are ignored.
  interpolate : str, optional default=linear
      Method to use for interpolation between specified values. ``nearest``
      means to use a single value for the whole triangle, and ``linear``
      means to do bilinear interpolation of the pixels within each
      triangle (a weighted average of the vertex values). For
      backwards compatibility, also accepts ``interp=True`` for ``linear``
      and ``interp=False`` for ``nearest``.
docstr_tok: ["Compute","a","reduction","by","pixel",",","mapping","data","to","pixels","as","a","triangle",".",">",">",">","import","datashader","as","ds",">",">",">","verts","=","pd.DataFrame","(","{","'","x","'",":","[","0",",","5",",","10","]",",","...","'","y","'",":","[","0",",","10",",","0","]",",","...","'weight","'",":","[","1",",","5",",","3","]","}",",","...","columns=","[","'","x","'",",","'","y","'",",","'weight","'","]",")",">",">",">","tris","=","pd.DataFrame","(","{","'v0","'",":","[","2","]",",","'v1","'",":","[","0","]",",","'v2","'",":","[","1","]","}",",","...","columns=","[","'v0","'",",","'v1","'",",","'v2","'","]",")",">",">",">","cvs","=","ds.Canvas","(","x_range=","(","verts.x.min","(",")",",","verts.x.max","(",")",")",",","...","y_range=","(","verts.y.min","(",")",",","verts.y.max","(",")",")",")",">",">",">","untested","=","cvs.trimesh","(","verts",",","tris",")","Parameters","--","--","--","--","--","vertices",":","pandas.DataFrame",",","dask.DataFrame","The","input","datasource","for","triangle","vertex","coordinates",".","These","can","be","interpreted","as","the","x\/y","coordinates","of","the","vertices",",","with","optional","weights","for","value","interpolation",".","Columns","should","be","ordered","corresponding","to","'","x","'",",","'","y","'",",","followed","by","zero","or","more","(","optional",")","columns","containing","vertex","values",".","The","rows","need","not","be","ordered",".","The","column","data","types","must","be","floating","point","or","integer",".","simplices",":","pandas.DataFrame",",","dask.DataFrame","The","input","datasource","for","triangle","(","simplex",")","definitions",".","These","can","be","interpreted","as","rows","of","``","vertices","``",",","aka","positions","in","the","``","vertices","``","index",".","Columns","should","be","ordered","corresponding","to","'vertex0","'",",","'vertex1","'",",","and","'vertex2","'",".","Order","of","the","vertices","can","be","clockwise","or","counter-clockwise",";","it","does","not","matter","as","long","as","the","data","is","consistent","for","all","simplices","in","the","dataframe",".","The","rows","need","not","be","ordered",".","The","data","type","for","the","first","three","columns","in","the","dataframe","must","be","integer",".","agg",":","Reduction",",","optional","Reduction","to","compute",".","Default","is","``","mean","(",")","``",".","mesh",":","pandas.DataFrame",",","optional","An","ordered","triangle","mesh","in","tabular","form",",","used","for","optimization","purposes",".","This","dataframe","is","expected","to","have","come","from","``","datashader.utils.mesh","(",")","``",".","If","this","argument","is","not","None",",","the","first","two","arguments","are","ignored",".","interpolate",":","str",",","optional","default=linear","Method","to","use","for","interpolation","between","specified","values",".","``","nearest","``","means","to","use","a","single","value","for","the","whole","triangle",",","and","``","linear","``","means","to","do","bilinear","interpolation","of","the","pixels","within","each","triangle","(","a","weighted","average","of","the","vertex","values",")",".","For","backwards","compatibility",",","also","accepts","``","interp=True","``","for","``","linear","``","and","``","interp=False","``","for","``","nearest","``","."]
code: def trimesh(
      self,
      vertices,
      simplices,
      mesh=None,
      agg=None,
      interp=True,
      interpolate=None,
  ):
      """Compute a reduction by pixel, mapping data to pixels as a triangle.
  
      >>> import datashader as ds
      >>> verts = pd.DataFrame({'x': [0, 5, 10],
      ...                         'y': [0, 10, 0],
      ...                         'weight': [1, 5, 3]},
      ...                        columns=['x', 'y', 'weight'])
      >>> tris = pd.DataFrame({'v0': [2], 'v1': [0], 'v2': [1]},
      ...                       columns=['v0', 'v1', 'v2'])
      >>> cvs = ds.Canvas(x_range=(verts.x.min(), verts.x.max()),
      ...                 y_range=(verts.y.min(), verts.y.max()))
      >>> untested = cvs.trimesh(verts, tris)
  
      Parameters
      ----------
      vertices : pandas.DataFrame, dask.DataFrame
          The input datasource for triangle vertex coordinates. These can be
          interpreted as the x/y coordinates of the vertices, with optional
          weights for value interpolation. Columns should be ordered
          corresponding to 'x', 'y', followed by zero or more (optional)
          columns containing vertex values. The rows need not be ordered.
          The column data types must be floating point or integer.
      simplices : pandas.DataFrame, dask.DataFrame
          The input datasource for triangle (simplex) definitions. These can
          be interpreted as rows of ``vertices``, aka positions in the
          ``vertices`` index. Columns should be ordered corresponding to
          'vertex0', 'vertex1', and 'vertex2'. Order of the vertices can be
          clockwise or counter-clockwise; it does not matter as long as the
          data is consistent for all simplices in the dataframe. The
          rows need not be ordered.  The data type for the first
          three columns in the dataframe must be integer.
      agg : Reduction, optional
          Reduction to compute. Default is ``mean()``.
      mesh : pandas.DataFrame, optional
          An ordered triangle mesh in tabular form, used for optimization
          purposes. This dataframe is expected to have come from
          ``datashader.utils.mesh()``. If this argument is not None, the first
          two arguments are ignored.
      interpolate : str, optional default=linear
          Method to use for interpolation between specified values. ``nearest``
          means to use a single value for the whole triangle, and ``linear``
          means to do bilinear interpolation of the pixels within each
          triangle (a weighted average of the vertex values). For
          backwards compatibility, also accepts ``interp=True`` for ``linear``
          and ``interp=False`` for ``nearest``.
      """
      from .glyphs import Triangles
      from .reductions import mean as mean_rdn
      from .utils import mesh as create_mesh
  
      source = mesh
  
      # 'interp' argument is deprecated as of datashader=0.6.4
      if interpolate is not None:
          if interpolate == "linear":
              interp = True
          elif interpolate == "nearest":
              interp = False
          else:
              raise ValueError(
                  "Invalid interpolate method: options include {}".format(
                      ["linear", "nearest"]
                  )
              )
  
      # Validation is done inside the [pd]d_mesh utility functions
      if source is None:
          source = create_mesh(vertices, simplices)
  
      verts_have_weights = len(vertices.columns) > 2
      if verts_have_weights:
          weight_col = vertices.columns[2]
      else:
          weight_col = simplices.columns[3]
  
      if agg is None:
          agg = mean_rdn(weight_col)
      elif agg.column is None:
          agg.column = weight_col
  
      cols = source.columns
      x, y, weights = cols[0], cols[1], cols[2:]
  
      return bypixel(
          source,
          self,
          Triangles(
              x,
              y,
              weights,
              weight_type=verts_have_weights,
              interp=interp,
          ),
          agg,
      )
  
imports: from __future__ import annotations
  from numbers import Number
  from math import log10
  import warnings
  import numpy
  import pandas
  import dask.dataframe
  import dask.array
  from xarray import DataArray, Dataset
  from .utils import Dispatcher, ngjit, calc_res, calc_bbox, orient_array, dshape_from_xarray_dataset
  from .utils import get_indices, dshape_from_pandas, dshape_from_dask
  from .utils import Expr
  from .resampling import resample_2d, resample_2d_distributed
  from .None import reductions
label_desc: Use image node_id 7 for calling the Canvas obj's underlying member method code with example usage: obj.trimesh(vertices, simplices, mesh, agg, interp, interpolate) and returns: bypixel