matplotlib / matplotlib/matplotlib
Colormaps are not matching with reference pngs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 23.2k
- Forks
- 8.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 66
Description
### Bug report
I've recently found out that built-in colormaps doesn't exactly match the ones shown on the [colormap reference](https://matplotlib.org/stable/gallery/color/colormap_reference.html).
Here's an example for the viridis colormap :
Last color on the png is `#fde724`:

Last color of the colormap is `#fde725`:
```python
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported discrepancy with Python 3.8, Matplotlib 3.3.0 or 3.4.2, and the `cm.get_cmap("viridis")` entry point. Compare the generated reference image with `matplotlib.colors.rgb2hex(colormap(colormap.N-1))`; done means identifying and documenting why the displayed and built-in colors differ, with a regression check if an appropriate test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100