FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[ENH]: Consider bilinear interpolation for pcolormesh · Issue #32518 · matplotlib/matplotlib · GitHub

Repository navigation

[ENH]: Consider bilinear interpolation for pcolormesh #32518

Open

Description

Problem

Currently the only "interpolating" shading of pcolormesh() is "gouraud". This is somewhat special: It splits the quadrilateral into two triangles and uses Gouraud shading for each. If the z values of the corners are not in a plane, this produces characteristic patterns and the result will depend on how the two triangles are chosen; e.g.

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(6)
y = np.arange(6)
X, Y = np.meshgrid(x, y)
Z = X + 2*Y
Z[2,3] = 15
plt.pcolormesh(X, Y, Z, shading="gouraud", edgecolors='red', linewidth=2)
plt.show()

Proposed solution

It would be nice to additionally have a simple bilinear interpolation.

Activity

  1. changed the title [-][ENH]: Condsider bilinear interpolation for pcolormesh[/-] [+][ENH]: Consider bilinear interpolation for pcolormesh[/+] on Oct 22, 2026
  2. ayshih commented on Oct 22, 2026

    Contributor

    This would be simple to implement when X/Y are not provided, but proper bilinear interpolation is mathematically complicated for arbitrary X/Y input (e.g., an irregular grid where the quadrilaterals are not parallelograms).

  3. timhoffm commented on Oct 23, 2026

    MemberAuthor

    It would be ok to only do this for rectangular / parallelogram quadrilaterals and error out otherwise.
    There may also be reasonable invertible transformations that transform an arbitrary quadrilateral to a “closest” regular quadrilateral on which we could apply the bilinear interpolation and transform the result back. But that would need a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL