Incorrect discrete 'curl' colormap
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization
Research direction
Start by running the issue's four-plot reproduction with matplotlib, cmocean, numpy, TwoSlopeNorm, and BoundaryNorm. Compare the cmo.balance and cmo.curl results under BoundaryNorm, then inspect the curl colormap setup and relevant normalization behavior; done means discrete curl colors are centered around 0 like the continuous example.
Written by the indexing model from the issue text.
Description
Looks like something is off when you specify a discrete normalization with the curl colormap.
The code below will produce 4 plots; the first 3 are as expected but the last one demonstrates the issue. Colors are no longer centered around 0 (white).
import matplotlib.pyplot as plt
import cmocean
import numpy as np
data = np.random.normal(loc=0, size=(10, 10))
norm = mpl.colors.TwoSlopeNorm(0, -2, 2)
plt.imshow(data, cmap='cmo.balance', norm=norm)
plt.colorbar()
plt.title('TwoSlopeNorm, Balance (Correct)')
plt.figure()
plt.imshow(data, cmap='cmo.curl', norm=norm)
plt.colorbar()
plt.title('TwoSlopeNorm, Curl (Correct)')
bounds = np.linspace(-2, 2, 21)
norm = mpl.colors.BoundaryNorm(bounds, 256)
plt.figure()
plt.imshow(data, cmap='cmo.balance', norm=norm)
plt.colorbar()
plt.title('BoundaryNorm, Balance (CORRECT)')
plt.figure()
plt.imshow(data, cmap='cmo.curl', norm=norm)
plt.colorbar()
plt.title('BoundaryNorm, Curl (INCORRECT)');
- Dominant language
- Python
- Stars
- 269
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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.
More from matplotlib/cmocean
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
matplotlib/cmocean#120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 50/100
matplotlib/cmocean#119 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
matplotlib/cmocean#118 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
matplotlib/cmocean#115 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
matplotlib/cmocean#112 ·
All issues in matplotlib/cmocean
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·