Skip to content

[ENH]: Mixed shading in pcolor/pcolormesh #31607

@Bzero

Description

@Bzero

Problem

Currently pcolor/pcolormesh support x and y coordinate grids that have either the same size as the 2D array to plot (shading='nearest'), or one larger than the array (shading='flat'). However, it is not possible to plot an array with a coordinate grid with the same size along one dimension and one larger along the other, i.e using one shading method along x and the other along y.

An example of data in this shape I occasionally deal with are spectra defined by the edges of the frequency bins, given at a number of points in time which I would like to plot as a spectrogram. Currently, it is not possible to make such a plot without adjusting the coordinate grid before the call to pcolor/pcolormesh .

Proposed solution

I would propose to allow specifying the shading style individually for both dimensions and to determine the shading style individually for both dimensions as well when using shading='auto'. To do so, the grid interpolation would have to be adjusted to do the grid interpolation along both dimensions separately.

To illustrate the proposed feature, an extended pcolormesh grids and shading example would look like this:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions