Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registering the colormaps with Matplotlib with original name #27

Open
mohseniaref opened this issue Jul 8, 2023 · 1 comment
Open

Comments

@mohseniaref
Copy link

Is your feature request related to a problem? Please describe.
My problem is I prefer to have something like
import cmcrameri # required in order to register the colormaps with Matplotlib
...
plt.imshow(x, aspect='auto', cmap='batlow')

Describe the solution you'd like
I think we don't need cmap_reg_prefix = "cmc."

I really appreciate if you can explain me how it might be problematic?

Best regards,
Mohammad

@callumrollo
Copy link
Owner

Hi Mohammad,

I'm not an expert in packaging, but with the "cmc" prefix I am attempting to follow the Python namespace practice to avoid name collisions. If I was to remove the prefix, and another colourmap package provided a colourmap called "batlow" or "grayC" a user wouldn't be able to import them both to compare. This is the same reason that we avoid doing things like from numpy import *.

This is an unlikely case on the face of it, but it's the practice used by more established colourmap packages like cmocean.

You can, of course, fork this repo and remake the colourmaps locally without the "cmc" prefix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants