Skip to content

Colormaps are not matching with reference pngs #20459

@manufont

Description

@manufont

Bug report

I've recently found out that built-in colormaps doesn't exactly match the ones shown on the colormap reference.

Here's an example for the viridis colormap :

Last color on the png is #fde724:
Screenshot from 2021-06-17 13-12-13

Last color of the colormap is #fde725:

In [35]: import matplotlib
    ...: from pylab import cm
    ...: colormap = cm.get_cmap("viridis")
    ...: matplotlib.colors.rgb2hex(colormap(colormap.N-1))
Out[35]: '#fde725'

I've tested only one other colormap (jet), and it had the same issue. Is there a reason for it ?

Matplotlib version

  • Operating system: Ubuntu 20.04
  • Matplotlib version 3.3.0 & 3.4.2
  • Matplotlib backend TkAgg
  • Python version: 3.8

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