B
    `                 @   sZ   d dl Zd dlmZ d dlmZmZ d dlmZ d dl	m
Z
 ddddddddd	d
ZdS )    N)cbook)PolyCollectionTriMesh)	Normalize)Triangulationg      ?flat)alphanormcmapvminvmaxshading
facecolorsc            O   s  t jddg|d tj||	\}
}}	|dk	r2|}nt|d }|dkrxt|t|
jkrxt|t|
jkrx|dkrx|}|dkrt|t|
jks|dk	rt|t|
jkrt	dd}d|	kr|	
d|	d	< |	d	| d
}d|	kr|	
d|	d< |	d|}d|	kr|	
d|	d< d|	kr8| d
kr8d|	d< |dkr~|dk	rTt	dt|t|
jkrpt	dt|
f|	}nf|
 }tj|
j| |
j| fdd}|dkr|| jdd}n|
jdk	r||
j  }t|f|	}|| || t jtdf|d || || |||| | d |
j }|
j }|
j }|
j }||f||ff}| | |   |  | |S )a  
    Create a pseudocolor plot of an unstructured triangular grid.

    The triangulation can be specified in one of two ways; either::

      tripcolor(triangulation, ...)

    where triangulation is a `.Triangulation` object, or

    ::

      tripcolor(x, y, ...)
      tripcolor(x, y, triangles, ...)
      tripcolor(x, y, triangles=triangles, ...)
      tripcolor(x, y, mask=mask, ...)
      tripcolor(x, y, triangles, mask=mask, ...)

    in which case a Triangulation object will be created.  See `.Triangulation`
    for a explanation of these possibilities.

    The next argument must be *C*, the array of color values, either
    one per point in the triangulation if color values are defined at
    points, or one per triangle in the triangulation if color values
    are defined at triangles. If there are the same number of points
    and triangles in the triangulation it is assumed that color
    values are defined at points; to force the use of color values at
    triangles use the kwarg ``facecolors=C`` instead of just ``C``.

    *shading* may be 'flat' (the default) or 'gouraud'. If *shading*
    is 'flat' and C values are defined at points, the color values
    used for each triangle are from the mean C of the triangle's
    three points. If *shading* is 'gouraud' then color values must be
    defined at points.

    The remaining kwargs are the same as for `~.Axes.pcolor`.
    r   Zgouraud)r   Nr   zgLength of color values array must be the same as either the number of triangulation points or triangles)g      ?Z	linewidth
linewidthsnoneZ	edgecolor
edgecolorsZantialiasedZantialiasedsFz<Gouraud shading does not support the use of facecolors kwargzlFor gouraud shading, the length of color values array must be the same as the number of triangulation points)Zaxis   )r	   )!r   Z_check_in_listr   Zget_from_args_and_kwargsnpZasarraylenZ	trianglesx
ValueErrorpop
setdefaultlowerr   Zget_masked_trianglesstackyZmeanmaskr   Z	set_alphaZ	set_arrayZ_check_isinstancer   Zset_cmapZset_normZ_scale_normZgridminmaxZupdate_datalimZautoscale_viewZadd_collection)Zaxr   r	   r
   r   r   r   r   argskwargsZtriCr   r   ZecZ
collectionZ
maskedTrisZvertsZminxZmaxxZminyZmaxyZcorners r#   G/home/dcms/DCMS/lib/python3.7/site-packages/matplotlib/tri/tripcolor.py	tripcolor	   sh    &














r%   )numpyr   Z
matplotlibr   Zmatplotlib.collectionsr   r   Zmatplotlib.colorsr   Zmatplotlib.tri.triangulationr   r%   r#   r#   r#   r$   <module>   s   