All Projects → hhuangwx → Cmaps

hhuangwx / Cmaps

Licence: gpl-3.0
user defined colormaps in matplotlib.

Projects that are alternatives of or similar to Cmaps

Robust Detection Benchmark
Code, data and benchmark from the paper "Benchmarking Robustness in Object Detection: Autonomous Driving when Winter is Coming" (NeurIPS 2019 ML4AD)
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Ipyexperiments
jupyter/ipython experiment containers for GPU and general RAM re-use
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Abstractive Summarization
Implementation of abstractive summarization using LSTM in the encoder-decoder architecture with local attention.
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Doodlenet
A doodle classifier(CNN), trained on all 345 categories from Quickdraw dataset.
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Ncnet
PyTorch code for Neighbourhood Consensus Networks
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Slicerjupyter
Extension for 3D Slicer that allows the application to be used from Jupyter notebook
Stars: ✭ 127 (+0.79%)
Mutual labels:  jupyter-notebook
Ipycytoscape
A Cytoscape Jupyter widget
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Pyvi
Python Vietnamese Core NLP Toolkit
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Cuxfilter
GPU accelerated cross filtering with cuDF.
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Rsis
Recurrent Neural Networks for Semantic Instance Segmentation
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Rasa Ptbr Boilerplate
Um template para criar um FAQ chatbot usando Rasa, Rocket.chat, elastic search
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Multimodal Speech Emotion
TensorFlow implementation of "Multimodal Speech Emotion Recognition using Audio and Text," IEEE SLT-18
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Ccm Site
NYU PSYCH-GA 3405.002 / DS-GS 3001.006 : Computational cognitive modeling
Stars: ✭ 127 (+0.79%)
Mutual labels:  jupyter-notebook
Chinese Chatbot
中文聊天机器人,基于10万组对白训练而成,采用注意力机制,对一般问题都会生成一个有意义的答复。已上传模型,可直接运行,跑不起来直播吃键盘。
Stars: ✭ 124 (-1.59%)
Mutual labels:  jupyter-notebook
Griffon Vm
Griffon Data Science Virtual Machine
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Focal Loss Pytorch
全中文注释.(The loss function of retinanet based on pytorch).(You can use it on one-stage detection task or classifical task, to solve data imbalance influence).用于one-stage目标检测算法,提升检测效果.你也可以在分类任务中使用该损失函数,解决数据不平衡问题.
Stars: ✭ 126 (+0%)
Mutual labels:  jupyter-notebook
Thepythonmegacourse
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Pydata Chicago2016 Ml Tutorial
Machine learning with scikit-learn tutorial at PyData Chicago 2016
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook
Gumbel
Gumbel-Softmax Variational Autoencoder with Keras
Stars: ✭ 127 (+0.79%)
Mutual labels:  jupyter-notebook
Byu econ applied machine learning
The course work for the applied machine learning course I am teaching at BYU
Stars: ✭ 128 (+1.59%)
Mutual labels:  jupyter-notebook

cmaps

Make it easier to use user defined colormaps in matplotlib. Default colormaps are from NCL_ website.

.. _NCL: http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml

Users can define a environmental variable CMAP_DIR pointing to the folder containing the self-defined rgb files.

Special thanks to Dr. Shen_: for suggestions and the help of uploading this package to Pypi and anaconda cloud.

.. _Shen: https://github.com/wqshen

Installation::

pip install cmaps

or::

conda install -c conda-forge cmaps

or::

git clone https://github.com/hhuangwx/cmaps.git
cd cmaps
python setup.py install

.. image:: examples/colormaps.png

Usage::

import matplotlib.pyplot as plt
import cmaps
import numpy as np

x = y = np.arange(-3.0, 3.01, 0.05)
X, Y = np.meshgrid(x, y)

sigmax = sigmay = 1.0
mux = muy = sigmaxy=0.0

Xmu = X-mux
Ymu = Y-muy

rho = sigmaxy/(sigmax*sigmay)
z = Xmu**2/sigmax**2 + Ymu**2/sigmay**2 - 2*rho*Xmu*Ymu/(sigmax*sigmay)
denom = 2*np.pi*sigmax*sigmay*np.sqrt(1-rho**2)
Z = np.exp(-z/(2*(1-rho**2))) / denom

plt.pcolormesh(X,Y,Z,cmap=cmaps.WhiteBlueGreenYellowRed)
plt.colorbar()

List the colormaps using the code in the examples::

import cmaps
import numpy as np
import inspect

import matplotlib.pyplot as plt
import matplotlib
matplotlib.rc('text', usetex=False)


def list_cmaps():
    attributes = inspect.getmembers(cmaps, lambda _: not (inspect.isroutine(_)))
    colors = [_[0] for _ in attributes if
              not (_[0].startswith('__') and _[0].endswith('__'))]
    return colors


if __name__ == '__main__':
    color = list_cmaps()

    a = np.outer(np.arange(0, 1, 0.001), np.ones(10))
    plt.figure(figsize=(20, 20))
    plt.subplots_adjust(top=0.95, bottom=0.05, left=0.01, right=0.99)
    ncmaps = len(color)
    nrows = 8
    for i, k in enumerate(color):
        plt.subplot(nrows, ncmaps // nrows + 1, i + 1)
        plt.axis('off')
        plt.imshow(a, aspect='auto', cmap=getattr(cmaps, k), origin='lower')
        plt.title(k, rotation=90, fontsize=10)
        plt.title(k, fontsize=10)
    plt.savefig('colormaps.png', dpi=300)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].