Skip to content

[Bug]: pcolormesh/pcolor doesn't show the image of an array of (M*1) OR (1*M) when providing X and Y explicitly #25699

Description

@chenyulue

Bug summary

pcolormesh/pcolor doesn't display the image of an array of size M*1 or 1*M when providing the parameters X and Y explicitly. If only the paramter C is provided, the two functions work well.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

x, y = np.meshgrid([1,2], [1])
z = x + y

plt.pcolor(x, y, z) # or plt.pcolormesh(x, y, z), both of which give an empty figure.
plt.pcolor(z) # or plt.pcolormesh(z), both of which work well.

Actual outcome

plt.pcolor(x, y, z) gives an empty figure, while plt.pcolor(z) works as expected.

Expected outcome

Both of plt.pcolor(x, y, z) and plt.pcolor(z) should show the chart.

Additional information

No response

Operating system

Windows

Matplotlib Version

3.7.1

Matplotlib Backend

module://matplotlib_inline.backend_inline OR QtAgg

Python version

3.10.10

Jupyter version

3.6.3

Installation

conda

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions