Giter Club home page Giter Club logo

cmcrameri's Introduction

Python package

Python 3.6 Python 3.7 Python 3.8 Python 3.9

Downloads (PyPI)

Conda Downloads (conda-forge)

cmcrameri

This is a Python wrapper around Fabio Crameri's perceptually uniform colormaps.

https://www.fabiocrameri.ch/colourmaps/

All credit for creating the colormaps to Fabio. Any errors in the Python implementation of colormaps are my own.

This version is based on Scientific colour maps version 7.0 (02.02.2021).

Install

With pip:

pip install cmcrameri

With conda:

conda install -c conda-forge cmcrameri

Usage example

import cmcrameri.cm as cmc
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 1, 100)[np.newaxis, :]

plt.imshow(x, aspect='auto', cmap=cmc.batlow)
plt.axis('off')
plt.show()

Alternatively, the registered name string can be used.

import cmrameri  # required in order to register the colormaps with Matplotlib
...
plt.imshow(x, aspect='auto', cmap='cmc.batlow')

Extra instructions

You can access all the core colormaps from Fabio Crameri's list by cmcrameri.cm.<colormapname>.

You can use tab autocompletion on cmcrameri.cm if your editor supports it.

For a reversed colormap, append _r to the colormap name.

Categorical colormaps have the suffix S.

For an image of all the available colormaps without leaving the comfort of your Python session:

from cmcrameri import show_cmaps

show_cmaps()

Figure demonstrating the colormaps

The original colormap text files are shipped as part of the package. Find them on your system with:

from cmcrameri.cm import paths

paths

License

This work is licensed under an MIT license.

cmcrameri's People

Contributors

callumrollo avatar zmoon avatar esiddle avatar flolangenfeld avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.