8000 Scatterplot: should vmin/vmax be ignored when a norm is specified? · Issue #14603 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Scatterplot: should vmin/vmax be ignored when a norm is specified? #14603
Closed
@jorisvandenbossche

Description

@jorisvandenbossche

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0