Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Classe « Axes »

Méthode matplotlib.figure.Axes.pcolor

Signature de la méthode pcolor

def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, colorizer=None, data=None, **kwargs) 

Description

help(Axes.pcolor)

Create a pseudocolor plot with a non-regular rectangular grid.

Call signature::

    pcolor([X, Y,] C, /, **kwargs)

*X* and *Y* can be used to specify the corners of the quadrilaterals.

The arguments *X*, *Y*, *C* are positional-only.

.. hint::

    ``pcolor()`` can be very slow for large arrays. In most
    cases you should use the similar but much faster
    `~.Axes.pcolormesh` instead. See
    :ref:`Differences between pcolor() and pcolormesh()
    <differences-pcolor-pcolormesh>` for a discussion of the
    differences.

Parameters
----------
C : 2D array-like
    The color-mapped values.  Color-mapping is controlled by *cmap*,
    *norm*, *vmin*, and *vmax*.

X, Y : array-like, optional
    The coordinates of the corners of quadrilaterals of a pcolormesh::

        (X[i+1, j], Y[i+1, j])       (X[i+1, j+1], Y[i+1, j+1])
                              ●╶───╴●
                              │     │
                              ●╶───╴●
            (X[i, j], Y[i, j])       (X[i, j+1], Y[i, j+1])

    Note that the column index corresponds to the x-coordinate, and
    the row index corresponds to y. For details, see the
    :ref:`Notes <axes-pcolormesh-grid-orientation>` section below.

    If ``shading='flat'`` the dimensions of *X* and *Y* should be one
    greater than those of *C*, and the quadrilateral is colored due
    to the value at ``C[i, j]``.  If *X*, *Y* and *C* have equal
    dimensions, a warning will be raised and the last row and column
    of *C* will be ignored.

    If ``shading='nearest'``, the dimensions of *X* and *Y* should be
    the same as those of *C* (if not, a ValueError will be raised). The
    color ``C[i, j]`` will be centered on ``(X[i, j], Y[i, j])``.

    If *X* and/or *Y* are 1-D arrays or column vectors they will be
    expanded as needed into the appropriate 2D arrays, making a
    rectangular grid.

shading : {'flat', 'nearest', 'auto'}, default: :rc:`pcolor.shading`
    The fill style for the quadrilateral. Possible values:

    - 'flat': A solid color is used for each quad. The color of the
      quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by
      ``C[i, j]``. The dimensions of *X* and *Y* should be
      one greater than those of *C*; if they are the same as *C*,
      then a deprecation warning is raised, and the last row
      and column of *C* are dropped.
    - 'nearest': Each grid point will have a color centered on it,
      extending halfway between the adjacent grid centers.  The
      dimensions of *X* and *Y* must be the same as *C*.
    - 'auto': Choose 'flat' if dimensions of *X* and *Y* are one
      larger than *C*.  Choose 'nearest' if dimensions are the same.

    See :doc:`/gallery/images_contours_and_fields/pcolormesh_grids`
    for more description.

cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
    The Colormap instance or registered colormap name used to map scalar data
    to colors.

norm : str or `~matplotlib.colors.Normalize`, optional
    The normalization method used to scale scalar data to the [0, 1] range
    before mapping to colors using *cmap*. By default, a linear scaling is
    used, mapping the lowest value to 0 and the highest to 1.

    If given, this can be one of the following:

    - An instance of `.Normalize` or one of its subclasses
      (see :ref:`colormapnorms`).
    - A scale name, i.e. one of "linear", "log", "symlog", "logit", etc.  For a
      list of available scales, call `matplotlib.scale.get_scale_names()`.
      In that case, a suitable `.Normalize` subclass is dynamically generated
      and instantiated.

vmin, vmax : float, optional
    When using scalar data and no explicit *norm*, *vmin* and *vmax* define
    the data range that the colormap covers. By default, the colormap covers
    the complete value range of the supplied data. It is an error to use
    *vmin*/*vmax* when a *norm* instance is given (but using a `str` *norm*
    name together with *vmin*/*vmax* is acceptable).

colorizer : `~matplotlib.colorizer.Colorizer` or None, default: None
    The Colorizer object used to map color to data. If None, a Colorizer
    object is created from a *norm* and *cmap*.

edgecolors : {'none', None, 'face', color, color sequence}, optional
    The color of the edges. Defaults to 'none'. Possible values:

    - 'none' or '': No edge.
    - *None*: :rc:`patch.edgecolor` will be used. Note that currently
      :rc:`patch.force_edgecolor` has to be True for this to work.
    - 'face': Use the adjacent face color.
    - A color or sequence of colors will set the edge color.

    The singular form *edgecolor* works as an alias.

alpha : float, default: None
    The alpha blending value of the face color, between 0 (transparent)
    and 1 (opaque). Note: The edgecolor is currently not affected by
    this.

snap : bool, default: False
    Whether to snap the mesh to pixel boundaries.

Returns
-------
`matplotlib.collections.PolyQuadMesh`

Other Parameters
----------------
antialiaseds : bool, default: False
    The default *antialiaseds* is False if the default
    *edgecolors*\ ="none" is used.  This eliminates artificial lines
    at patch boundaries, and works regardless of the value of alpha.
    If *edgecolors* is not "none", then the default *antialiaseds*
    is taken from :rc:`patch.antialiased`.
    Stroking the edges may be preferred if *alpha* is 1, but will
    cause artifacts otherwise.

data : indexable object, optional
    If given, all parameters also accept a string ``s``, which is
    interpreted as ``data[s]`` if ``s`` is a key in ``data``.

**kwargs
    Additionally, the following arguments are allowed. They are passed
    along to the `~matplotlib.collections.PolyQuadMesh` constructor:

Properties:
    agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
    alpha: array-like or scalar or None
    animated: bool
    antialiased or aa or antialiaseds: bool or list of bools
    array: array-like or None
    capstyle: `.CapStyle` or {'butt', 'projecting', 'round'}
    clim: (vmin: float, vmax: float)
    clip_box: `~matplotlib.transforms.BboxBase` or None
    clip_on: bool
    clip_path: Patch or (Path, Transform) or None
    cmap: `.Colormap` or str or None
    color: :mpltype:`color` or list of RGBA tuples
    edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or 'face'
    facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color`
    figure: `~matplotlib.figure.Figure` or `~matplotlib.figure.SubFigure`
    gid: str
    hatch: {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
    hatch_linewidth: unknown
    in_layout: bool
    joinstyle: `.JoinStyle` or {'miter', 'round', 'bevel'}
    label: object
    linestyle or dashes or linestyles or ls: str or tuple or list thereof
    linewidth or linewidths or lw: float or list of floats
    mouseover: bool
    norm: `.Normalize` or str or None
    offset_transform or transOffset: `.Transform`
    offsets: (N, 2) or (2,) array-like
    path_effects: list of `.AbstractPathEffect`
    paths: list of array-like
    picker: None or bool or float or callable
    pickradius: float
    rasterized: bool
    sizes: `numpy.ndarray` or None
    sketch_params: (scale: float, length: float, randomness: float)
    snap: bool or None
    transform: `~matplotlib.transforms.Transform`
    url: str
    urls: list of str or None
    verts: list of array-like
    verts_and_codes: unknown
    visible: bool
    zorder: float

See Also
--------
pcolormesh : for an explanation of the differences between
    pcolor and pcolormesh.
imshow : If *X* and *Y* are each equidistant, `~.Axes.imshow` can be a
    faster alternative.

Notes
-----
**Masked arrays**

*X*, *Y* and *C* may be masked arrays. If either ``C[i, j]``, or one
of the vertices surrounding ``C[i, j]`` (*X* or *Y* at
``[i, j], [i+1, j], [i, j+1], [i+1, j+1]``) is masked, nothing is
plotted.

.. _axes-pcolor-grid-orientation:

**Grid orientation**

The grid orientation follows the standard matrix convention: An array
*C* with shape (nrows, ncolumns) is plotted with the column number as
*X* and the row number as *Y*.


Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé