You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Doc]: document how to get list of registered colormaps #26244
Okay, my progress was the following, I wrote a few lines in the file colormaps.py where I create a function called listColormaps() the important thing is that according to the type of colormap it will list the available patterns.
Now, I find it useful to declare in a global way the variables of the colormap types that exist, that is to say: Perceptually, Sequential, Sequential2, Cyclic, Qualitative, Miscellaneous. In such a way that if more patterns are developed it will be easier to extend the functionalities.
Attached is the code
# New function to list the actually colormaps on matplotlibdeflistColormaps(category):
# Define a dictionary that maps each category to its corresponding list of colormapscolormaps_by_category= {
'Perceptually': ['viridis', 'plasma', 'inferno', 'magma', 'cividis'],
'Sequential': ['Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn'],
'Sequential2': ['binary', 'gist_yarg', 'gist_gray', 'gray', 'bone',
'pink', 'spring', 'summer', 'autumn', 'winter', 'cool',
'Wistia', 'hot', 'afmhot', 'gist_heat', 'copper'],
'Diverging': ['PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu',
'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic'],
'Cyclic': ['twilight', 'twilight_shifted', 'hsv'],
'Qualitative': ['Pastel1', 'Pastel2', 'Paired', 'Accent', 'Dark2',
'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b',
'tab20c'],
'Miscellaneous': ['flag', 'prism', 'ocean', 'gist_earth', 'terrain',
'gist_stern', 'gnuplot', 'gnuplot2', 'CMRmap',
'cubehelix', 'brg', 'gist_rainbow', 'rainbow', 'jet',
'turbo', 'nipy_spectral', 'gist_ncar']
}
# Return the list of colormaps for the given category, or an empty list if the category is not foundreturncolormaps_by_category.get(category, [])
This issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide.
We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR.
Activity
MrZaurik commentedon Jul 18, 2023
Like a function or what are you meaning?. Look at this
Actually this are the colors that you can choose for your plots. In the left side you can see the name, and next to this the colormap.
EDIT: A couple more.
oscargus commentedon Jul 19, 2023
I think it means that something like the following should be added:
MrZaurik commentedon Jul 19, 2023
Perfect. I'll be work on this.
Update colormaps.py with listColormaps
Update colormaps.py with listColormaps
Update colormaps.py with listColormaps
MrZaurik commentedon Jul 19, 2023
Okay, my progress was the following, I wrote a few lines in the file colormaps.py where I create a function called listColormaps() the important thing is that according to the type of colormap it will list the available patterns.
Now, I find it useful to declare in a global way the variables of the colormap types that exist, that is to say: Perceptually, Sequential, Sequential2, Cyclic, Qualitative, Miscellaneous. In such a way that if more patterns are developed it will be easier to extend the functionalities.
Attached is the code
tacaswell commentedon Jul 20, 2023
In https://matplotlib.org/stable/api/cm_api.html#matplotlib.cm.ColormapRegistry it is clearly marked as a subsclass of a
Mappingand sayI think it is reasonable to expect users to infer that
list(my_mapping)gets you all of the keys in the mapping.I think at most we need a note in explain/colors/colormaps.html to the same effect.
github-actions commentedon Sep 10, 2023
Good first issue - notes for new contributors
This issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide.
We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR.
If something is unclear, please reach out on any of our communication channels.
story645 commentedon Sep 10, 2023
Flagging this as a good first issue because the solution is add what @oscargus wrote in #26244 (comment) in the locations described in #26244 (comment)
Backport PR matplotlib#26930: Added documentation on getting full lis…
Backport PR matplotlib#26930: Added documentation on getting full lis…
Merge pull request #27122 from meeseeksmachine/auto-backport-of-pr-26…
Added documentation on getting full list of registered colormaps re: …