Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yt-project/cmyt
yt-native colormaps
https://github.com/yt-project/cmyt
Last synced: 2 months ago
JSON representation
yt-native colormaps
- Host: GitHub
- URL: https://github.com/yt-project/cmyt
- Owner: yt-project
- License: other
- Created: 2021-07-15T13:09:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-01T16:42:10.000Z (3 months ago)
- Last Synced: 2024-12-08T01:50:23.611Z (3 months ago)
- Language: Python
- Size: 5.41 MB
- Stars: 9
- Watchers: 8
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmyt
[](https://pypi.org/project/cmyt)
[](https://anaconda.org/conda-forge/cmyt)[](https://github.com/yt-project/cmyt/actions/workflows/ci.yml)
[](https://github.com/yt-project/cmyt/actions/workflows/bleeding-edge.yaml)
[](https://results.pre-commit.ci/latest/github/yt-project/cmyt/main)[](https://yt-project.org)
[](https://github.com/charliermarsh/ruff)Matplotlib colormaps from the yt project !
## Colormaps overview
The following colormaps, as well as their respective reversed (`*_r`) versions are available
### Perceptually uniform sequential colormaps
![]()
### Monochromatic sequential colormaps
![]()
### Miscellaneous
![]()
## Installation
with `pip`
```shell
python -m pip install cmyt
```
or with `conda`
```shell
conda install -c conda-forge cmyt
```## Usage
cmyt integrates with matplotlib in a similar fashion to
[cmocean](https://matplotlib.org/cmocean/) or
[cmasher](https://cmasher.readthedocs.io)
```python
import numpy as np
import matplotlib.pyplot as plt
import cmyt # that's it !# generate example data
prng = np.random.RandomState(0x4D3D3D3)
noise = prng.random_sample((100, 100))
x, y = np.mgrid[-50:50, -50:50]
z = 5 * np.exp(-(x**2 + y**2) / 1000)# setup the figure
fig, ax = plt.subplots()
ax.set(aspect="equal")# now we can refer to cmyt colormaps as strings
im = ax.pcolormesh(x, y, z + noise, cmap="cmyt.arbre", shading="flat")
fig.colorbar(im, ax=ax)
```
![]()
```python
# alternatively, cmyt maps can also be imported as objects
from cmyt import pastelfig, ax = plt.subplots()
ax.set(aspect="equal")
im = ax.contourf(x, y, z + noise, cmap=pastel)
fig.colorbar(im, ax=ax)
```
![]()
A gallery of comparable examples using all colormaps from cmyt is available [in the test directory](https://github.com/yt-project/cmyt/tree/main/tests/baseline).