Skip to content

Passing clim as keyword argument to pcolormesh does not change limits. #10346

@heathhenley

Description

@heathhenley

Bug report

Bug summary

Not sure if this is really a bug or just a user issue. I expected that passing a clim tuple to pcolormesh with no vmin or vmax specified would update the color scale limits. I found that I had to use vmin and vmax instead. Maybe I am misunderstanding and vmin and vmax should always be used. However, it looks like the kwargs are passed into the QuadMesh constructor and then clim is overwritten with vmin and vmax, even in they are None and clim is given. (https://github.com/heath730/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L5629).

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np


plot_me = np.random.rand(5, 5)

plt.subplot(211)
plt.title("Expected")
plt.pcolormesh(plot_me, vmin=0, vmax=0.5)
plt.colorbar()

plt.subplot(212)
plt.title("Result")
plt.pcolormesh(plot_me, clim=(0, 0.5))
plt.colorbar()

plt.show()

figure_1

Matplotlib version

  • Operating system: win7
  • Matplotlib version: 2.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.5.1
  • Jupyter version (if applicable):
  • Other libraries:

Would something like:

  (vmin, vmax) = kwargs.pop('clim', (None, None))

Before the vmin and vmax pops on this line be a reasonable update?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy