squink(Colors,Gamma​)

版本 1.4.0.0 (6.5 KB) 作者: David Powers
This improves on current colormaps: vivid well known colors plus smoothly increasing in mono print
174.0 次下载
更新时间 2016/8/19

查看许可证

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:
blacK-Squink-Blue-Navy-Teal-Leaf-Green-Drab-Chestnut-Honey-Gold-Red-Maroon-Fuchsia-Pink-White
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).

Usage:
colormap(squink)
sets the same size color map as currently used in your current figure
colormap(squink(N))
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

引用格式

David Powers (2024). squink(Colors,Gamma) (https://www.mathworks.com/matlabcentral/fileexchange/58204-squink-colors-gamma), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2006a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

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

1.3.0.0

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

1.2.0.0

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

1.1.0.0

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)

1.0.0.0