Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

brewermap.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. function [map,num,typ,scheme] = brewermap(N,scheme) %#ok<*ISMAT>
  2. % The complete selection of ColorBrewer colorschemes (RGB colormaps).
  3. %
  4. % (c) 2014-2020 Stephen Cobeldick
  5. %
  6. % Returns any RGB colormap from the ColorBrewer colorschemes, especially
  7. % intended for mapping and plots with attractive, distinguishable colors.
  8. %
  9. %%% Basic Syntax:
  10. % brewermap() % print summary
  11. % map = brewermap(N,scheme)
  12. %%% Preset Syntax:
  13. % old = brewermap(scheme)
  14. % map = brewermap()
  15. % map = brewermap(N)
  16. %
  17. % [...,num,typ] = brewermap(...)
  18. %
  19. %% Color Schemes %%
  20. %
  21. % This product includes color specifications and designs developed by Cynthia Brewer.
  22. % See the ColorBrewer website for further information about each colorscheme,
  23. % colour-blind suitability, licensing, and citations: http://colorbrewer.org/
  24. % Each colorscheme is defined by a set of hand-picked RGB values (nodes).
  25. % To reverse the colormap sequence simply prefix the scheme name with '*'.
  26. %
  27. % If <N> is greater than the requested colorscheme's number of nodes then:
  28. % * Diverging and Sequential schemes are interpolated in Lab colorspace.
  29. % * Qualitative schemes repeat the nodes (i.e. just like LINES does).
  30. % Else:
  31. % * Exact values from the ColorBrewer schemes are returned for all colorschemes.
  32. %
  33. %%% Diverging
  34. %
  35. % Scheme|'BrBG'|'PRGn'|'PiYG'|'PuOr'|'RdBu'|'RdGy'|'RdYlBu'|'RdYlGn'|'Spectral'|
  36. % ------|------|------|------|------|------|------|--------|--------|----------|
  37. % Nodes | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 |
  38. %
  39. %%% Qualitative
  40. %
  41. % Scheme|'Accent'|'Dark2'|'Paired'|'Pastel1'|'Pastel2'|'Set1'|'Set2'|'Set3'|
  42. % ------|--------|-------|--------|---------|---------|------|------|------|
  43. % Nodes | 8 | 8 | 12 | 9 | 8 | 9 | 8 | 12 |
  44. %
  45. %%% Sequential
  46. %
  47. % Scheme|'Blues'|'BuGn'|'BuPu'|'GnBu'|'Greens'|'Greys'|'OrRd'|'Oranges'|'PuBu'|
  48. % ------|-------|------|------|------|--------|-------|------|---------|------|
  49. % Nodes | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 |
  50. %
  51. % Scheme|'PuBuGn'|'PuRd'|'Purples'|'RdPu'|'Reds'|'YlGn'|'YlGnBu'|'YlOrBr'|'YlOrRd'|
  52. % ------|--------|------|---------|------|------|------|--------|--------|--------|
  53. % Nodes | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 |
  54. %
  55. %% Examples %%
  56. %
  57. %%% Plot a scheme's RGB values:
  58. % >> rgbplot(brewermap(9, 'Blues')) % standard
  59. % >> rgbplot(brewermap(9,'*Blues')) % reversed
  60. %
  61. %%% View information about a colorscheme:
  62. % >> [~,num,typ] = brewermap(NaN,'Paired')
  63. % num = 12
  64. % typ = 'Qualitative'
  65. %
  66. %%% Multi-line plot using matrices:
  67. % >> N = 6;
  68. % >> axes('ColorOrder',brewermap(N,'Pastel2'),'NextPlot','replacechildren')
  69. % >> X = linspace(0,pi*3,1000);
  70. % >> Y = bsxfun(@(x,n)n*sin(x+2*n*pi/N), X(:), 1:N);
  71. % >> plot(X,Y, 'linewidth',4)
  72. %
  73. %%% Multi-line plot in a loop:
  74. % set(0,'DefaultAxesColorOrder',brewermap(NaN,'Accent'))
  75. % N = 6;
  76. % X = linspace(0,pi*3,1000);
  77. % Y = bsxfun(@(x,n)n*sin(x+2*n*pi/N), X(:), 1:N);
  78. % for n = 1:N
  79. % plot(X(:),Y(:,n), 'linewidth',4);
  80. % hold all
  81. % end
  82. %
  83. %%% New colors for the COLORMAP example:
  84. % >> S = load('spine');
  85. % >> image(S.X)
  86. % >> colormap(brewermap([],'YlGnBu'))
  87. %
  88. %%% New colors for the SURF example:
  89. % >> [X,Y,Z] = peaks(30);
  90. % >> surfc(X,Y,Z)
  91. % >> colormap(brewermap([],'RdYlGn'))
  92. % >> axis([-3,3,-3,3,-10,5])
  93. %
  94. %% Input and Output Arguments %%
  95. %
  96. %%% Inputs:
  97. % N = NumericScalar, N>=0, an integer to specify the colormap length.
  98. % = [], same length as the current figure's colormap (see COLORMAP).
  99. % = NaN, same length as the defining RGB nodes (useful for line ColorOrder).
  100. % scheme = CharRowVector, a ColorBrewer colorscheme name.
  101. %
  102. %%% Outputs:
  103. % map = NumericMatrix, size Nx3, a colormap of RGB values between 0 and 1.
  104. % num = NumericVector, the number of nodes defining the ColorBrewer colorscheme.
  105. % typ = CharRowVector, the colorscheme type: 'Diverging'/'Qualitative'/'Sequential'.
  106. %
  107. % See also CUBEHELIX LBMAP PARULA LINES RGBPLOT COLORMAP COLORBAR PLOT PLOT3 AXES SET
  108. %% Input Wrangling %%
  109. %
  110. persistent scm
  111. %
  112. raw = bmColors();
  113. %
  114. err = 'First input must be a real positive scalar numeric or [] or NaN.';
  115. if nargin==0&&nargout==0
  116. hdr = { 'Type'; 'Scheme'; 'Nodes'};
  117. tsn = [{raw.typ};{raw.str};{raw.num}];
  118. fprintf('%-12s %-9s %s\n',hdr{:});
  119. fprintf('%-12s %-9s %u\n',tsn{:});
  120. return
  121. elseif nargin==0 || isnumeric(N)&&isequal(N,[])
  122. % Default is the same as MATLAB colormaps:
  123. N = size(get(gcf,'colormap'),1);
  124. if nargin<2
  125. assert(~isempty(scm),'SC:colorbrewer:SchemeNotPreset',...
  126. 'Scheme must be preset before this call: BREWERMAP(SCHEME)')
  127. scheme = scm;
  128. end
  129. elseif nargin==1&&ischar(N)&&ndims(N)==2&&size(N,1)==1
  130. if strcmpi(N,'list')
  131. map = {raw.str};
  132. num = [raw.num];
  133. typ = {raw.typ};
  134. return
  135. end
  136. scheme = N; % preset
  137. else
  138. assert(isnumeric(N)&&isscalar(N),...
  139. 'SC:brewermap:NotScalarNumeric',err)
  140. assert(isnan(N)||isreal(N)&&isfinite(N)&&fix(N)==N&&N>=0,...
  141. 'SC:brewermap:NotRealPositiveNotNaN',err)
  142. end
  143. %
  144. assert(ischar(scheme)&&ndims(scheme)==2&&size(scheme,1)==1,...
  145. 'SC:brewermap:NotCharacterVector',...
  146. 'Second input must be a character vector (the scheme name).')
  147. isr = strncmp(scheme,'*',1);
  148. ids = strcmpi(scheme(1+isr:end),{raw.str});
  149. assert(any(ids),'SC:brewermap:UnknownScheme','Unknown scheme name: %s',scheme)
  150. %
  151. num = raw(ids).num;
  152. typ = raw(ids).typ;
  153. %
  154. if ischar(N)
  155. map = scm;
  156. scm = N;
  157. return
  158. elseif N==0
  159. map = ones(0,3);
  160. return
  161. elseif isnan(N)
  162. N = num;
  163. end
  164. %
  165. % Downsample:
  166. [idx,itp] = bmIndex(N,num,typ);
  167. map= raw(ids).rgb(idx,:)/255;
  168. % Interpolate:
  169. if itp
  170. M = [... sRGB to XYZ
  171. 0.4124564,0.3575761,0.1804375;...
  172. 0.2126729,0.7151522,0.0721750;...
  173. 0.0193339,0.1191920,0.9503041];
  174. wpt = [0.95047,1,1.08883]; % D65
  175. %
  176. map = bmRGB2Lab(map,M,wpt); % optional
  177. %
  178. % Extrapolate a small amount beyond end nodes:
  179. %ido = linspace(0,num+1,N+2);
  180. %ido = ido(2:end-1);
  181. % Interpolation completely within end nodes:
  182. ido = linspace(1,num,N);
  183. %
  184. switch typ
  185. case 'Diverging'
  186. mid = ceil(num/2);
  187. ida = 1:mid;
  188. idz = mid:num;
  189. map = [...
  190. interp1(ida,map(ida,:),ido(ido<=mid),'pchip');...
  191. interp1(idz,map(idz,:),ido(ido>mid),'pchip')];
  192. case 'Sequential'
  193. map = interp1(1:num,map,ido,'pchip');
  194. otherwise
  195. error('SC:brewermap:NoInterp','Cannot interpolate this type.')
  196. end
  197. %
  198. map = bmLab2RGB(map,M,wpt); % optional
  199. end
  200. % Limit output range:
  201. map = max(0,min(1,map));
  202. % Reverse row order:
  203. if isr
  204. map = map(end:-1:1,:);
  205. end
  206. %
  207. end
  208. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%brewermap
  209. function lab = bmRGB2Lab(rgb,M,wpt)
  210. % Convert a matrix of sRGB values to Lab.
  211. %applycform(rgb,makecform('srgb2lab','AdaptedWhitePoint',wpt))
  212. % RGB2XYZ:
  213. xyz = bmGammaInv(rgb) * M.';
  214. % Remember to include my license when copying my implementation.
  215. % XYZ2Lab:
  216. xyz = bsxfun(@rdivide,xyz,wpt);
  217. idx = xyz>(6/29)^3;
  218. F = idx.*(xyz.^(1/3)) + ~idx.*(xyz*(29/6)^2/3+4/29);
  219. lab(:,2:3) = bsxfun(@times,[500,200],F(:,1:2)-F(:,2:3));
  220. lab(:,1) = 116*F(:,2) - 16;
  221. end
  222. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bmRGB2Lab
  223. function rgb = bmGammaInv(rgb)
  224. % Inverse gamma correction of sRGB data.
  225. idx = rgb <= 0.04045;
  226. rgb(idx) = rgb(idx) / 12.92;
  227. rgb(~idx) = real(((rgb(~idx) + 0.055) / 1.055).^2.4);
  228. end
  229. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bmGammaInv
  230. function rgb = bmLab2RGB(lab,M,wpt)
  231. % Convert a matrix of Lab values to sRGB.
  232. %applycform(lab,makecform('lab2srgb','AdaptedWhitePoint',wpt))
  233. % Lab2XYZ
  234. tmp = bsxfun(@rdivide,lab(:,[2,1,3]),[500,Inf,-200]);
  235. tmp = bsxfun(@plus,tmp,(lab(:,1)+16)/116);
  236. idx = tmp>(6/29);
  237. tmp = idx.*(tmp.^3) + ~idx.*(3*(6/29)^2*(tmp-4/29));
  238. xyz = bsxfun(@times,tmp,wpt);
  239. % Remember to include my license when copying my implementation.
  240. % XYZ2RGB
  241. rgb = max(0,min(1, bmGammaCor(xyz / M.')));
  242. end
  243. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%cbLab2RGB
  244. function rgb = bmGammaCor(rgb)
  245. % Gamma correction of sRGB data.
  246. idx = rgb <= 0.0031308;
  247. rgb(idx) = 12.92 * rgb(idx);
  248. rgb(~idx) = real(1.055 * rgb(~idx).^(1/2.4) - 0.055);
  249. end
  250. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bmGammaCor
  251. function [idx,itp] = bmIndex(N,num,typ)
  252. % Ensure exactly the same colors as the online ColorBrewer colorschemes.
  253. %
  254. itp = N>num;
  255. switch typ
  256. case 'Qualitative'
  257. itp = false;
  258. idx = 1+mod(0:N-1,num);
  259. case 'Diverging'
  260. switch N
  261. case 1 % extrapolated
  262. idx = 8;
  263. case 2 % extrapolated
  264. idx = [4,12];
  265. case 3
  266. idx = [5,8,11];
  267. case 4
  268. idx = [3,6,10,13];
  269. case 5
  270. idx = [3,6,8,10,13];
  271. case 6
  272. idx = [2,5,7,9,11,14];
  273. case 7
  274. idx = [2,5,7,8,9,11,14];
  275. case 8
  276. idx = [2,4,6,7,9,10,12,14];
  277. case 9
  278. idx = [2,4,6,7,8,9,10,12,14];
  279. case 10
  280. idx = [1,2,4,6,7,9,10,12,14,15];
  281. otherwise
  282. idx = [1,2,4,6,7,8,9,10,12,14,15];
  283. end
  284. case 'Sequential'
  285. switch N
  286. case 1 % extrapolated
  287. idx = 6;
  288. case 2 % extrapolated
  289. idx = [4,8];
  290. case 3
  291. idx = [3,6,9];
  292. case 4
  293. idx = [2,5,7,10];
  294. case 5
  295. idx = [2,5,7,9,11];
  296. case 6
  297. idx = [2,4,6,7,9,11];
  298. case 7
  299. idx = [2,4,6,7,8,10,12];
  300. case 8
  301. idx = [1,3,4,6,7,8,10,12];
  302. otherwise
  303. idx = [1,3,4,6,7,8,10,11,13];
  304. end
  305. otherwise
  306. error('SC:brewermap:UnknownType','Unknown type string.')
  307. end
  308. %
  309. end
  310. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bmIndex
  311. function raw = bmColors()
  312. % Return a structure of all colorschemes: name, scheme type, RGB values, number of nodes.
  313. % Order: first sort by <typ>, then case-insensitive sort by <str>:
  314. raw(35).str = 'YlOrRd';
  315. raw(35).typ = 'Sequential';
  316. raw(35).rgb = [255,255,204;255,255,178;255,237,160;254,217,118;254,204,92;254,178,76;253,141,60;252,78,42;240,59,32;227,26,28;189,0,38;177,0,38;128,0,38];
  317. raw(34).str = 'YlOrBr';
  318. raw(34).typ = 'Sequential';
  319. raw(34).rgb = [255,255,229;255,255,212;255,247,188;254,227,145;254,217,142;254,196,79;254,153,41;236,112,20;217,95,14;204,76,2;153,52,4;140,45,4;102,37,6];
  320. raw(33).str = 'YlGnBu';
  321. raw(33).typ = 'Sequential';
  322. raw(33).rgb = [255,255,217;255,255,204;237,248,177;199,233,180;161,218,180;127,205,187;65,182,196;29,145,192;44,127,184;34,94,168;37,52,148;12,44,132;8,29,88];
  323. raw(32).str = 'YlGn';
  324. raw(32).typ = 'Sequential';
  325. raw(32).rgb = [255,255,229;255,255,204;247,252,185;217,240,163;194,230,153;173,221,142;120,198,121;65,171,93;49,163,84;35,132,67;0,104,55;0,90,50;0,69,41];
  326. raw(31).str = 'Reds';
  327. raw(31).typ = 'Sequential';
  328. raw(31).rgb = [255,245,240;254,229,217;254,224,210;252,187,161;252,174,145;252,146,114;251,106,74;239,59,44;222,45,38;203,24,29;165,15,21;153,0,13;103,0,13];
  329. raw(30).str = 'RdPu';
  330. raw(30).typ = 'Sequential';
  331. raw(30).rgb = [255,247,243;254,235,226;253,224,221;252,197,192;251,180,185;250,159,181;247,104,161;221,52,151;197,27,138;174,1,126;122,1,119;122,1,119;73,0,106];
  332. raw(29).str = 'Purples';
  333. raw(29).typ = 'Sequential';
  334. raw(29).rgb = [252,251,253;242,240,247;239,237,245;218,218,235;203,201,226;188,189,220;158,154,200;128,125,186;117,107,177;106,81,163;84,39,143;74,20,134;63,0,125];
  335. raw(28).str = 'PuRd';
  336. raw(28).typ = 'Sequential';
  337. raw(28).rgb = [247,244,249;241,238,246;231,225,239;212,185,218;215,181,216;201,148,199;223,101,176;231,41,138;221,28,119;206,18,86;152,0,67;145,0,63;103,0,31];
  338. raw(27).str = 'PuBuGn';
  339. raw(27).typ = 'Sequential';
  340. raw(27).rgb = [255,247,251;246,239,247;236,226,240;208,209,230;189,201,225;166,189,219;103,169,207;54,144,192;28,144,153;2,129,138;1,108,89;1,100,80;1,70,54];
  341. raw(26).str = 'PuBu';
  342. raw(26).typ = 'Sequential';
  343. raw(26).rgb = [255,247,251;241,238,246;236,231,242;208,209,230;189,201,225;166,189,219;116,169,207;54,144,192;43,140,190;5,112,176;4,90,141;3,78,123;2,56,88];
  344. raw(25).str = 'Oranges';
  345. raw(25).typ = 'Sequential';
  346. raw(25).rgb = [255,245,235;254,237,222;254,230,206;253,208,162;253,190,133;253,174,107;253,141,60;241,105,19;230,85,13;217,72,1;166,54,3;140,45,4;127,39,4];
  347. raw(24).str = 'OrRd';
  348. raw(24).typ = 'Sequential';
  349. raw(24).rgb = [255,247,236;254,240,217;254,232,200;253,212,158;253,204,138;253,187,132;252,141,89;239,101,72;227,74,51;215,48,31;179,0,0;153,0,0;127,0,0];
  350. raw(23).str = 'Greys';
  351. raw(23).typ = 'Sequential';
  352. raw(23).rgb = [255,255,255;247,247,247;240,240,240;217,217,217;204,204,204;189,189,189;150,150,150;115,115,115;99,99,99;82,82,82;37,37,37;37,37,37;0,0,0];
  353. raw(22).str = 'Greens';
  354. raw(22).typ = 'Sequential';
  355. raw(22).rgb = [247,252,245;237,248,233;229,245,224;199,233,192;186,228,179;161,217,155;116,196,118;65,171,93;49,163,84;35,139,69;0,109,44;0,90,50;0,68,27];
  356. raw(21).str = 'GnBu';
  357. raw(21).typ = 'Sequential';
  358. raw(21).rgb = [247,252,240;240,249,232;224,243,219;204,235,197;186,228,188;168,221,181;123,204,196;78,179,211;67,162,202;43,140,190;8,104,172;8,88,158;8,64,129];
  359. raw(20).str = 'BuPu';
  360. raw(20).typ = 'Sequential';
  361. raw(20).rgb = [247,252,253;237,248,251;224,236,244;191,211,230;179,205,227;158,188,218;140,150,198;140,107,177;136,86,167;136,65,157;129,15,124;110,1,107;77,0,75];
  362. raw(19).str = 'BuGn';
  363. raw(19).typ = 'Sequential';
  364. raw(19).rgb = [247,252,253;237,248,251;229,245,249;204,236,230;178,226,226;153,216,201;102,194,164;65,174,118;44,162,95;35,139,69;0,109,44;0,88,36;0,68,27];
  365. raw(18).str = 'Blues';
  366. raw(18).typ = 'Sequential';
  367. raw(18).rgb = [247,251,255;239,243,255;222,235,247;198,219,239;189,215,231;158,202,225;107,174,214;66,146,198;49,130,189;33,113,181;8,81,156;8,69,148;8,48,107];
  368. raw(17).str = 'Set3';
  369. raw(17).typ = 'Qualitative';
  370. raw(17).rgb = [141,211,199;255,255,179;190,186,218;251,128,114;128,177,211;253,180,98;179,222,105;252,205,229;217,217,217;188,128,189;204,235,197;255,237,111];
  371. raw(16).str = 'Set2';
  372. raw(16).typ = 'Qualitative';
  373. raw(16).rgb = [102,194,165;252,141,98;141,160,203;231,138,195;166,216,84;255,217,47;229,196,148;179,179,179];
  374. raw(15).str = 'Set1';
  375. raw(15).typ = 'Qualitative';
  376. raw(15).rgb = [228,26,28;55,126,184;77,175,74;152,78,163;255,127,0;255,255,51;166,86,40;247,129,191;153,153,153];
  377. raw(14).str = 'Pastel2';
  378. raw(14).typ = 'Qualitative';
  379. raw(14).rgb = [179,226,205;253,205,172;203,213,232;244,202,228;230,245,201;255,242,174;241,226,204;204,204,204];
  380. raw(13).str = 'Pastel1';
  381. raw(13).typ = 'Qualitative';
  382. raw(13).rgb = [251,180,174;179,205,227;204,235,197;222,203,228;254,217,166;255,255,204;229,216,189;253,218,236;242,242,242];
  383. raw(12).str = 'Paired';
  384. raw(12).typ = 'Qualitative';
  385. raw(12).rgb = [166,206,227;31,120,180;178,223,138;51,160,44;251,154,153;227,26,28;253,191,111;255,127,0;202,178,214;106,61,154;255,255,153;177,89,40];
  386. raw(11).str = 'Dark2';
  387. raw(11).typ = 'Qualitative';
  388. raw(11).rgb = [27,158,119;217,95,2;117,112,179;231,41,138;102,166,30;230,171,2;166,118,29;102,102,102];
  389. raw(10).str = 'Accent';
  390. raw(10).typ = 'Qualitative';
  391. raw(10).rgb = [127,201,127;190,174,212;253,192,134;255,255,153;56,108,176;240,2,127;191,91,23;102,102,102];
  392. raw(09).str = 'Spectral';
  393. raw(09).typ = 'Diverging';
  394. raw(09).rgb = [158,1,66;213,62,79;215,25,28;244,109,67;252,141,89;253,174,97;254,224,139;255,255,191;230,245,152;171,221,164;153,213,148;102,194,165;43,131,186;50,136,189;94,79,162];
  395. raw(08).str = 'RdYlGn';
  396. raw(08).typ = 'Diverging';
  397. raw(08).rgb = [165,0,38;215,48,39;215,25,28;244,109,67;252,141,89;253,174,97;254,224,139;255,255,191;217,239,139;166,217,106;145,207,96;102,189,99;26,150,65;26,152,80;0,104,55];
  398. raw(07).str = 'RdYlBu';
  399. raw(07).typ = 'Diverging';
  400. raw(07).rgb = [165,0,38;215,48,39;215,25,28;244,109,67;252,141,89;253,174,97;254,224,144;255,255,191;224,243,248;171,217,233;145,191,219;116,173,209;44,123,182;69,117,180;49,54,149];
  401. raw(06).str = 'RdGy';
  402. raw(06).typ = 'Diverging';
  403. raw(06).rgb = [103,0,31;178,24,43;202,0,32;214,96,77;239,138,98;244,165,130;253,219,199;255,255,255;224,224,224;186,186,186;153,153,153;135,135,135;64,64,64;77,77,77;26,26,26];
  404. raw(05).str = 'RdBu';
  405. raw(05).typ = 'Diverging';
  406. raw(05).rgb = [103,0,31;178,24,43;202,0,32;214,96,77;239,138,98;244,165,130;253,219,199;247,247,247;209,229,240;146,197,222;103,169,207;67,147,195;5,113,176;33,102,172;5,48,97];
  407. raw(04).str = 'PuOr';
  408. raw(04).typ = 'Diverging';
  409. raw(04).rgb = [127,59,8;179,88,6;230,97,1;224,130,20;241,163,64;253,184,99;254,224,182;247,247,247;216,218,235;178,171,210;153,142,195;128,115,172;94,60,153;84,39,136;45,0,75];
  410. raw(03).str = 'PRGn';
  411. raw(03).typ = 'Diverging';
  412. raw(03).rgb = [64,0,75;118,42,131;123,50,148;153,112,171;175,141,195;194,165,207;231,212,232;247,247,247;217,240,211;166,219,160;127,191,123;90,174,97;0,136,55;27,120,55;0,68,27];
  413. raw(02).str = 'PiYG';
  414. raw(02).typ = 'Diverging';
  415. raw(02).rgb = [142,1,82;197,27,125;208,28,139;222,119,174;233,163,201;241,182,218;253,224,239;247,247,247;230,245,208;184,225,134;161,215,106;127,188,65;77,172,38;77,146,33;39,100,25];
  416. raw(01).str = 'BrBG';
  417. raw(01).typ = 'Diverging';
  418. raw(01).rgb = [84,48,5;140,81,10;166,97,26;191,129,45;216,179,101;223,194,125;246,232,195;245,245,245;199,234,229;128,205,193;90,180,172;53,151,143;1,133,113;1,102,94;0,60,48];
  419. % number of nodes:
  420. for k = 1:numel(raw)
  421. switch raw(k).typ
  422. case 'Diverging'
  423. raw(k).num = 11;
  424. case 'Qualitative'
  425. raw(k).num = size(raw(k).rgb,1);
  426. case 'Sequential'
  427. raw(k).num = 9;
  428. otherwise
  429. error('SC:brewermap:UnknownType','Unknown type string.')
  430. end
  431. end
  432. %
  433. end
  434. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%bmColors
  435. % Code and Implementation:
  436. % Copyright (c) 2014-2020 Stephen Cobeldick
  437. % Color Values Only:
  438. % Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.
  439. %
  440. % Licensed under the Apache License, Version 2.0 (the "License");
  441. % you may not use this file except in compliance with the License.
  442. % You may obtain a copy of the License at
  443. %
  444. % http://www.apache.org/licenses/LICENSE-2.0
  445. %
  446. % Unless required by applicable law or agreed to in writing, software
  447. % distributed under the License is distributed on an "AS IS" BASIS,
  448. % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  449. % See the License for the specific language governing permissions and limitations under the License.
  450. %
  451. % Redistribution and use in source and binary forms, with or without
  452. % modification, are permitted provided that the following conditions are met:
  453. %
  454. % 1. Redistributions as source code must retain the above copyright notice, this
  455. % list of conditions and the following disclaimer.
  456. %
  457. % 2. The end-user documentation included with the redistribution, if any, must
  458. % include the following acknowledgment: "This product includes color
  459. % specifications and designs developed by Cynthia Brewer
  460. % (http://colorbrewer.org/)." Alternately, this acknowledgment may appear in the
  461. % software itself, if and wherever such third-party acknowledgments normally appear.
  462. %
  463. % 4. The name "ColorBrewer" must not be used to endorse or promote products
  464. % derived from this software without prior written permission. For written
  465. % permission, please contact Cynthia Brewer at cbrewer@psu.edu.
  466. %
  467. % 5. Products derived from this software may not be called "ColorBrewer", nor
  468. % may "ColorBrewer" appear in their name, without prior written permission of Cynthia Brewer.
  469. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%license