Skip to content

MovGP0/tinycolormapdotnet

Repository files navigation

Tinycolormap .NET

Color map library for scientific visualizations. This library is a .NET port of tinycolormap.

Available Colormaps

Matlab

Name Sample
Parula
Heat
Hot
Jet
Gray
HSV

Reference: https://www.mathworks.com/help/matlab/ref/colormap.html

The HSV colormap is cyclic and is particularly useful for plotting angles or phases because the color transition from 1 to 0 is smooth. A phase wrap would thus not appear as a sharp edge.

Matplotlib

Name Sample
Magma
Inferno
Plasma
Viridis
Cividis

These colormaps are designed to be perceptually uniform (even in black-and-white printing) and friendly to colorblindness. Cividis is specially designed such that it enables as identical interpretation to both those without a CVD and those with red-green colorblindness as possible.

Magma, Inferno, Plasma, Viridis are released under CC0 by Nathaniel J. Smith, Stefan van der Walt, and (in the case of Viridis) Eric Firing: https://github.com/BIDS/colormap/blob/master/colormaps.py. Their python code is adapted for the use in C#.

Cividis is released under CC0 by the authors of PLOS ONE paper (Jamie R. Nuñez, Christopher R. Anderton, Ryan S. Renslow): https://doi.org/10.1371/journal.pone.0199239. We incorporated the LUT into C#.

GitHub

Name Sample
Github

This colormap is designed to mimic the color scheme used in GitHub contributions visualization.

Other

Name Sample
Turbo

Turbo is developed as an alternative to the Jet colormap by Anton Mikhailov (Google LLC). See the blog post for the details. The original lookup table is released under the Apache 2.0 license. We merged it and re-licensed the part under the MIT license for consistency.

Name Sample
Cubehelix

Cubehelix is developed by Dr. Dave Green and is designed for astronomical intensity images. It shows a continuous increase in perceived intensity when shown in color or greyscale. This implementation uses Green's "default" scheme (start: 0.5, rotations: -1.5, hue: 1.0, gamma: 1.0). See the original publication for details.

Usage

The core function of this library is

var color = Color.GetColor(double x, ColormapType type);

where x should be between 0.0 and 1.0 (otherwise, it will be cropped), and type is the target colormap type like Viridis (default) and Heat.

Quantized colors

tinycolormap is also capable of producing quantized colormaps (i.e. the ones that have visible boundaries between colors) based on the user specified number of levels. Below is the example of the quantized Parula colormap using 10 quantization levels:

Name Sample
Parula

Note that the supported range for number of levels is [1, 255].

To create a colormap quantization use:

var color = Color.GetColor(double x, uint quantization, ColormapType type);

About

.NET port of TinyColorMap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages