Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Scatterplot: should vmin/vmax be ignored when a norm is specified? #14603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorisvandenbossche opened this issue Jun 23, 2019 · 1 comment · Fixed by #15769
Closed

Scatterplot: should vmin/vmax be ignored when a norm is specified? #14603

jorisvandenbossche opened this issue Jun 23, 2019 · 1 comment · Fixed by #15769

Comments

@jorisvandenbossche
Copy link

Bug report

Bug summary

The scatter documentation says:

vmin and vmax are ignored if you pass a norm instance.

However, it seems that this is not the case. Is the documentation correct of the behaviour?

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
import matplotlib

cmap = matplotlib.cm.viridis_r
norm = matplotlib.colors.BoundaryNorm([1,3,6,8], cmap.N, clip=True)

values = np.arange(10)

# only specifying a norm
plt.scatter(values, values, c=values, norm=norm)

# also specifying vmin/vmax. Should those be ignored?
plt.scatter(values, values, c=values, norm=norm, vmin=6, vmax=10)

Actual outcome

# only specifying a norm
plt.scatter(values, values, c=values, norm=norm)

index

# also specifying vmin/vmax. Should those be ignored?
plt.scatter(values, values, c=values, norm=norm, vmin=6, vmax=10)

index2

So the vmin/vmax have clearly "altered" the BoundaryNorm applied on the data.

According to the documentation, this should not happen.
Specifically for a BoundaryNorm (with specified bounds), it seems strange let the plotting change those bounds.

Matplotlib version

  • Operating system: Ubuntu 16.04
  • Matplotlib version: 3.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): notebook inline backend
  • Python version: 3.7
  • Installed from conda-forge
@story645
Copy link
Member

Not that this should change anything, but what happens when clip is false?

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

Successfully merging a pull request may close this issue.

3 participants