`cmocean.tools.print_colormaps` snippet in the docs raises an error
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation
Research direction
Start with the capabilities example linked in the issue and cmocean/tools.py around line 23; run the documented snippet and inspect how print_colormaps handles its input and writes output. Update the documentation example so it no longer raises the reported error, and clarify or verify where its output files should appear.
Written by the indexing model from the issue text.
Description
Hello! I love your work, this is my favorite set of colormaps.
Today I wanted to run some code from the docs:
import cmocean
cmaps = cmocean.cm.cmap_d
cmocean.tools.print_colormaps(cmaps)
and it produces the following exception and traceback:
Traceback (most recent call last):
File "/home/mfisher/Projects/_test/extend-colormaps-js/test.py", line 4, in <module>
cmocean.tools.print_colormaps(cmaps)
File "/home/mfisher/Projects/_test/extend-colormaps-js/.pixi/envs/default/lib/python3.12/site-packages/cmocean/tools.py", line 25, in print_colormaps
rgbtemp = cmap(np.linspace(0, 1, N))[np.newaxis, :, :3][0]
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'str' object is not callable
The issue appears to be here:
We loop over the cmaps object, which is a dictionary of colormap name keys to colormap object values in this invocation, but the function expects the object to be a list of colormap objects.
So the docs could be updated to:
import cmocean
cmaps = cmocean.cm.cmap_d
cmocean.tools.print_colormaps(cmaps.values())
But after running this code I don't see the output files!
- 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 3/5 1-2 days Newbie friendliness 45/100
matplotlib/cmocean#116 ·
-
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
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·