QuadMesh.get_clim changed behavior in 3.3.0rc1 · Issue #17703 · matplotlib/matplotlib · GitHub
Skip to content

QuadMesh.get_clim changed behavior in 3.3.0rc1 #17703

Description

@MaozGelbart

Bug report

Bug summary

QuadMesh.get_clim() is documented as:

Return the values (min, max) that are mapped to the colormap limits.

Without vmin or vmax arguments to pcolormesh, this returns the data minimal and maximal values. However in the presence of only one of vmin or vmax, a change occurred between 3.2.2 and 3.3.0rc1. In 3.3.0rc1 it returns the input vmin and vmax, though only one of them was specified. The provided examples also happens (with slight output changes) for setting vmax instead of vmin.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

dx, dy = 0.15, 0.05
y, x = np.mgrid[slice(-3, 3 + dy, dy),
                slice(-3, 3 + dx, dx)]
z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
z = z[:-1, :-1]

f, ax = plt.subplots(1,1)
ax.pcolormesh(x, y, z, vmin=0)
ax.axis([x.min(), x.max(), y.min(), y.max()])
for mesh in ax.collections:
    print(mesh.get_clim())

Actual outcome

# 3.3.0rc1
(0.0, None)

Expected outcome

# 3.2.2
(0.0, 1.0510083319982622)

Matplotlib version

  • Operating system: MacOSX
  • Matplotlib version: 3.3.0rc1
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.8.3

Installed using pip

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions