Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tom-draper/matplotlib-colors
A collection of curated color profiles for matplotlib.
https://github.com/tom-draper/matplotlib-colors
colors colorschemes data-visualization graph matplotlib matplotlib-styles plot python styles vizualisation
Last synced: 3 months ago
JSON representation
A collection of curated color profiles for matplotlib.
- Host: GitHub
- URL: https://github.com/tom-draper/matplotlib-colors
- Owner: tom-draper
- License: mit
- Created: 2022-11-02T12:50:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-09T13:51:27.000Z (about 2 years ago)
- Last Synced: 2024-04-26T21:48:01.506Z (8 months ago)
- Topics: colors, colorschemes, data-visualization, graph, matplotlib, matplotlib-styles, plot, python, styles, vizualisation
- Language: Python
- Homepage: https://pypi.org/project/matplotlib-colors/
- Size: 545 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Matplotlib Colors
A collection of curated colors and colormaps for matplotlib.
## Installation
```bash
pip install matplotlib-colors
```## Demo
[All colors and colormaps](matplotlib_colors/README.md)
## Examples
### Colormaps
Call the `register_cmaps` function to add the new colormaps to matplotlib. Then the desired colormap can be specified by name as the `cmap` argument.
```py
from matplotlib_colors import register_cmaps
register_cmaps() # Adds new colormaps to matplotlib# Build your data viz as normal with matplotlib
import numpy as np
import matplotlib.pyplot as pltx = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=range(12), cmap='analyst') # Specify one of the new colormap names
plt.colorbar()
plt.show()
```Alternatively, all new colormap objects can be accessed directly by importing the `colormaps` dict and specifying a colormap by name.
```py
from matplotlib_colors import colormaps
import numpy as np
import matplotlib.pyplot as pltx = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=range(12), cmap=colormaps['analyst']) # Specify a colormap from colormaps dict
plt.colorbar()
plt.show()
```The full list of colormap names can be found by importing the `colormap_names` list.
```py
from matplotlib_colors import colormap_names
```### Colors
The package includes a large selection of colors that can be accessed directly by importing `colors` and specifying a color name.
```py
from matplotlib_colors import colors
import matplotlib.pyplot as pltx = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=colors['pl_red']) # All points colored with PL_RED
plt.colorbar()
plt.show()
```The full list of color names can be found by importing the `color_names` list.
```py
from matplotlib_colors import color_names
```