Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Incorrect discrete 'curl' colormap

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

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

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)');

Image

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matplotlib/cmocean

All issues in matplotlib/cmocean

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.