This improves on current colormaps: vivid well known colors plus smoothly increasing in mono print
174 téléchargements
Mise à jour 19 août 2016

Afficher la licence

Squink is a color map maximizing discrimination in color or grayscale view

Set color map through 16 steps from Black/Squink thru BCGYRM to Pink/White:
- aim is to improve on rgb, cym, hsv, jet and jetviolet - optimized for Web+Print papers;
- aim is to be as good as jetwhite with broader green-brown-yellow + strictly monotonic gray
whereas jetwhite snakes with near monotonic grayscale to hit strict primaries,
the squink jetviolet-jetpink snakes by primaries with a strictly monotonic HSI intensity.

- existing smooth grayscale Colors are muddy or washed out - fixed now by squink
- jetwhite Colors have pure BCGYRM and nonmonotonic grayscale - fixed by squink
- squink BCGY tend to be darker adding SquidInkPurple/Navy/Teal ... Chestnut/Honey/Olive
- squink RM tend to be less saturated/lighter so lighter distinctions remain
Sequence is white to black (positive Colors) or black to white (negative Colors) as follows, for Colors>15:
Note that Navy is a Blue, Teal is a dark Cyan, Leaf and Drab are shades of Green, Maroon is a pinky Red, Fuchsia is a saturated Magenta, and Drab, Chestnut and Honey are shades of brown tending to green, red and yellow. The map is perceptually optimized so that at up to 100 colors all shades can be discriminated from their neighbors while the gray scale progression is perceptually smooth.
Squink interpolates from squidy inky purplish blacks through all the major colors to pinkish whites. 17 named colors hit precisely if multiple of 16 is used (16n --> exc. black) or one more (16n+1 --> inc. black).

sets the same size color map as currently used in your current figure
for N<0 this has black as the base color, and for N>0 white as base color
for |N|<16 a 16|N| grayscale map is generated for print, else |N| KSBNTLGDCHGORMFPW colors
for |N|>~128 this will be perceptually smooth without discernible steps
for |N|<<128 there will be perceptual steps between (most) Colors
for |N|=16n there are integer n intepolations between colours and noblack
for |N|=16n+1 there are integer n intepolations between colours and black
for |N|=16n+r for r>1 black is squid ink and interpolations are less even

The 16th color of squink17 is squid ink which gives its name to this script.
The maps with more colors interpolate (hence need both black and white).
The maps can be truncated without black which is distinguishable in gmap.
Thus contours, ticks & text in gray/black are distinguishable in figures.
The best maps are multiples of 16 without black or one more to add black.
The neutral color is brown and maximum discrimination is green/magenta.
The first/base color is white if a multiple of 16 is used and then pink.
Negated maps reverse scheme so base color is a shade of black to squink.

To approximate what map looks like in monochrome print divide Colours by 16.
Viz. we are collapsing out the 16 colour transitions to average to gray.

color map showing the 15 named intermediate Colors that are interpolated:
% Color RedGreenBlueMean
% white 255 255 255 255
% pink 255 145 230 210
% fuchsia 250 56 220 175
% maroon 250 50 150 150
% red 255 73 72 133
% orange 230 115 40 128
% gold 200 150 0 117
% honey 175 110 10 98
% chestnut 150 70 40 87
% drab 90 120 30 80
% green 0 227 0 76
% leaf 0 155 55 70
% teal 0 95 97 64
% navy 0 50 121 57
% blue 0 0 153 51
% squink 32 0 100 44
% black 0 0 0 0

Note that the grayscale optimizes is HSI Intensity which is a simple average of all three hues, and the smoothness when printed in monochrome will depend on the model used by the printer, with the HSL lightness being an average of the minimum and maximum RGB components (ignores one component) and the HSV value being the maximum RGB component (ignores two components) while models that aim to be more natural use weighting that depend on the specific RGB primaries and tend to have most weight on green and least weight on blue, leading to a brighter green band. Matlab's RGB2gray converts with an overemphasis on blue leading to clamping of whites. The usual weights for NTSC/PAL/YUV/YCbCr/YPbPr are [0.299 0.587 0.114] and for sRGB primaries is [0.21 0.72 0.07], while for modern screens and printers colour gamuts may vary but displays can generally be set to approximate sRGB. Examples are included in help on adjusting gamma. One can make a PrPb-weighted version as follows, or reweight the colours in a complementary way:

colormap(repmat(sum((squink(Colors).*repmat([0.21 0.72 0.07],Colors,1))')',1,3))

colormap(squink(Colors).*repmat([1 0.7 0.8],Colors,1))

Copyright 2016 David M W Powers - All rights reserved

Citation pour cette source

David Powers (2024). squink(Colors,Gamma) (https://www.mathworks.com/matlabcentral/fileexchange/58204-squink-colors-gamma), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2006a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
En savoir plus sur Colormaps dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version

Added gamma control parameter and showed examples contrasting printer and sRGB targets, dampened greens.

spreads black-Squink by further 1% for displays/media with large head/footroom (indistinguishable white/black range)
added discussion of colour spaces, weight and gamuts
minor edit of description - restored whitespace

more format/typo/grammo tweaking
more text tweaks to format nicely
and once more add back the stolen white space between paragraphs!
missed a tan
wanting to acknowledge code used
grammo fixed - pity can't preview...
clarified colors used
try again with grammo - probably made wrong version of map plural in my three line window into the text
This time edit is focussed on the disappearing white space

Use Honey instead of Tan to ensure first letter is unique for all shades (K is used for blacK and B for blue per standard)