parameters: (ax, mesh, data=None, tri=False, rasterized=False,
                cMin=None, cMax=None, logScale=False,
                xlabel=None, ylabel=None, fitView=True, verbose=False,
                **kwargs)
return_statement: return gci
docstring: Draw a 2d mesh and color the cell by the data.
  
      Parameters
      ----------
      ax : mpl axis instance, optional
          Axis instance where the mesh is plotted (default is current axis).
      mesh : :gimliapi:`GIMLI::Mesh`
          The plotted mesh to browse through.
      data : array, optional
          Data to draw. Should either equal numbers of cells or nodes of the
          corresponding `mesh`.
      tri : boolean, optional
          use MPL tripcolor (experimental)
      rasterized : boolean, optional
          Rasterize mesh patches to reduce file size and avoid zooming artifacts
          in some PDF viewers.
      fitView : bool [True]
          Adjust ax limits to mesh bounding box.
  
      Keyword Arguments
      -----------------
      **kwargs
          Additional kwargs forwarded to the draw functions and mpl methods,
          respectively.
  
      Returns
      -------
      gci : matplotlib graphics object
  
      Examples
      --------
      >>> import numpy as np
      >>> import matplotlib.pyplot as plt
      >>> import pygimli as pg
      >>> from pygimli.viewer.mpl import drawModel
      >>> n = np.linspace(0, -2, 11)
      >>> mesh = pg.createGrid(x=n, y=n)
      >>> mx = pg.x(mesh.cellCenter())
      >>> my = pg.y(mesh.cellCenter())
      >>> data = np.cos(1.5 * mx) * np.sin(1.5 * my)
      >>> fig, ax = plt.subplots()
      >>> drawModel(ax, mesh, data)
      <matplotlib.collections.PolyCollection object at ...>
docstring_summary: Draw a 2d mesh and color the cell by the data.
docstring_tokens: Draw a 2d mesh and color the cell by the data .
function: def drawModel(ax, mesh, data=None, tri=False, rasterized=False,
                cMin=None, cMax=None, logScale=False,
                xlabel=None, ylabel=None, fitView=True, verbose=False,
                **kwargs):
      """Draw a 2d mesh and color the cell by the data.
  
      Parameters
      ----------
      ax : mpl axis instance, optional
          Axis instance where the mesh is plotted (default is current axis).
      mesh : :gimliapi:`GIMLI::Mesh`
          The plotted mesh to browse through.
      data : array, optional
          Data to draw. Should either equal numbers of cells or nodes of the
          corresponding `mesh`.
      tri : boolean, optional
          use MPL tripcolor (experimental)
      rasterized : boolean, optional
          Rasterize mesh patches to reduce file size and avoid zooming artifacts
          in some PDF viewers.
      fitView : bool [True]
          Adjust ax limits to mesh bounding box.
  
      Keyword Arguments
      -----------------
      **kwargs
          Additional kwargs forwarded to the draw functions and mpl methods,
          respectively.
  
      Returns
      -------
      gci : matplotlib graphics object
  
      Examples
      --------
      >>> import numpy as np
      >>> import matplotlib.pyplot as plt
      >>> import pygimli as pg
      >>> from pygimli.viewer.mpl import drawModel
      >>> n = np.linspace(0, -2, 11)
      >>> mesh = pg.createGrid(x=n, y=n)
      >>> mx = pg.x(mesh.cellCenter())
      >>> my = pg.y(mesh.cellCenter())
      >>> data = np.cos(1.5 * mx) * np.sin(1.5 * my)
      >>> fig, ax = plt.subplots()
      >>> drawModel(ax, mesh, data)
      <matplotlib.collections.PolyCollection object at ...>
      """
      # deprecated .. remove me
      if 'cMap' in kwargs or 'cmap' in kwargs:
          pg.warn('cMap|cmap argument is deprecated for draw functions. ' +
                  'Please use show or customize a colorbar.')
      # deprecated .. remove me
  
      if mesh.nodeCount() == 0:
          pg.error("drawModel: The mesh is empty.", mesh)
  
      if tri or 'shading' in kwargs:
          gci = drawField(ax, mesh, data,
                          cMin=cMin, cMax=cMax, logScale=logScale,
                           **kwargs)
      else:
          gci = pg.viewer.mpl.createMeshPatches(ax, mesh, rasterized=rasterized,
                                                verbose=verbose)
          ax.add_collection(gci)
  
          if data is None:
              data = pg.Vector(mesh.cellCount())
  
          if len(data) != mesh.cellCount():
              print(data, mesh)
              pg.info("drawModel have wrong data length .. " +
                      " indexing data from cellMarkers()")
              viewdata = data[mesh.cellMarkers()]
          else:
              viewdata = data
  
          pg.viewer.mpl.setMappableData(gci, viewdata,
                                        cMin=cMin, cMax=cMax, logScale=logScale,
                                        **kwargs)
  
      gci.set_antialiased(True)
      gci.set_linewidths(0.1)
      gci.set_edgecolors("face")
  
      if xlabel is not None:
          ax.set_xlabel(xlabel)
  
      if ylabel is not None:
          ax.set_ylabel(ylabel)
  
      if fitView is True:
          ax.autoscale(enable=True, axis='both', tight=True)
          ax.set_aspect('equal')
  
      updateAxes_(ax)
      return gci
function_tokens: def drawModel ( ax , mesh , data = None , tri = False , rasterized = False , cMin = None , cMax = None , logScale = False , xlabel = None , ylabel = None , fitView = True , verbose = False , * * kwargs ) : # deprecated .. remove me if 'cMap' in kwargs or 'cmap' in kwargs : pg . warn ( 'cMap|cmap argument is deprecated for draw functions. ' + 'Please use show or customize a colorbar.' ) # deprecated .. remove me if mesh . nodeCount ( ) == 0 : pg . error ( "drawModel: The mesh is empty." , mesh ) if tri or 'shading' in kwargs : gci = drawField ( ax , mesh , data , cMin = cMin , cMax = cMax , logScale = logScale , * * kwargs ) else : gci = pg . viewer . mpl . createMeshPatches ( ax , mesh , rasterized = rasterized , verbose = verbose ) ax . add_collection ( gci ) if data is None : data = pg . Vector ( mesh . cellCount ( ) ) if len ( data ) != mesh . cellCount ( ) : print ( data , mesh ) pg . info ( "drawModel have wrong data length .. " + " indexing data from cellMarkers()" ) viewdata = data [ mesh . cellMarkers ( ) ] else : viewdata = data pg . viewer . mpl . setMappableData ( gci , viewdata , cMin = cMin , cMax = cMax , logScale = logScale , * * kwargs ) gci . set_antialiased ( True ) gci . set_linewidths ( 0.1 ) gci . set_edgecolors ( "face" ) if xlabel is not None : ax . set_xlabel ( xlabel ) if ylabel is not None : ax . set_ylabel ( ylabel ) if fitView is True : ax . autoscale ( enable = True , axis = 'both' , tight = True ) ax . set_aspect ( 'equal' ) updateAxes_ ( ax ) return gci