Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

colormaps don't have getters for under, over, bad colors. #16075

Copy link
Copy link
Closed
@pharshalp

Description

@pharshalp
Issue body actions

Bug report

Bug summary
colormaps don't have getters for under, over, bad colors (although the corresponding setters exist).
I am writing a function that accepts a colormap as an argument. I want to ensure that the colormap passed to the function has the same color for the "bad" and "under" conditions. The only way around this is to access "private" attributes cmap._rgba_under, cmap._rgba_bad as shown below.

Code for reproduction

cmap = plt.get_cmap('cividis')
cmap.set_bad('k')
cmap.set_under('k')

assert cmap._rgba_bad == cmap._rgba_under

If adding getters (for under, over, bad colors) for the colormaps sounds like a good improvement, i would be interested in submitting a PR.

Actual outcome

# If applicable, paste the console output here
#
#

Expected outcome

Matplotlib version

  • Operating system:
  • Matplotlib version:
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.