TikZ 色度图

TikZ 色度图

我正在尝试在 tikZ 中制作色度图,有人知道如何制作吗?

我要这个 在此处输入图片描述

我的问题不在于形成我可以做的光谱轨迹,现在我只使用三个点,但我试图为图表着色。有人有什么指点吗,或者他们以前做过这个吗?

另外,是的,我知道色度图不应该被着色,因为我们的显示器无法产生完整的图表等等。因此,色彩科学 101 放在一边。

Matlab 代码制作轨迹的形状

 cie.lambda = [380:5:780];

%load CIE color matching data
cie.cmf2deg =    1.0e+02 * [3.800000000000000   0.000013680000000   0.000000390000000   0.000064500000000;
   3.850000000000000   0.000022360000000   0.000000640000000   0.000105500000000;
   3.900000000000000   0.000042430000000   0.000001200000000   0.000200500000000;
   3.950000000000000   0.000076500000000   0.000002170000000   0.000362100000000;
   4.000000000000000   0.000143100000000   0.000003960000000   0.000678500000000;
   4.050000000000000   0.000231900000000   0.000006400000000   0.001102000000000;
   4.100000000000000   0.000435100000000   0.000012100000000   0.002074000000000;
   4.150000000000000   0.000776300000000   0.000021800000000   0.003713000000000;
   4.200000000000000   0.001343800000000   0.000040000000000   0.006456000000000;
   4.250000000000000   0.002147700000000   0.000073000000000   0.010390500000000;
   4.300000000000000   0.002839000000000   0.000116000000000   0.013856000000000;
   4.350000000000000   0.003285000000000   0.000168400000000   0.016229600000000;
   4.400000000000000   0.003482800000000   0.000230000000000   0.017470600000000;
   4.450000000000000   0.003480600000000   0.000298000000000   0.017826000000000;
   4.500000000000000   0.003362000000000   0.000380000000000   0.017721100000000;
   4.550000000000000   0.003187000000000   0.000480000000000   0.017441000000000;
   4.600000000000000   0.002908000000000   0.000600000000000   0.016692000000000;
   4.650000000000000   0.002511000000000   0.000739000000000   0.015281000000000;
   4.700000000000000   0.001953600000000   0.000909800000000   0.012876400000000;
   4.750000000000000   0.001421000000000   0.001126000000000   0.010419000000000;
   4.800000000000000   0.000956400000000   0.001390200000000   0.008129500000000;
   4.850000000000000   0.000579500000000   0.001693000000000   0.006162000000000;
   4.900000000000000   0.000320100000000   0.002080200000000   0.004651800000000;
   4.950000000000000   0.000147000000000   0.002586000000000   0.003533000000000;
   5.000000000000000   0.000049000000000   0.003230000000000   0.002720000000000;
   5.050000000000000   0.000024000000000   0.004073000000000   0.002123000000000;
   5.100000000000000   0.000093000000000   0.005030000000000   0.001582000000000;
   5.150000000000000   0.000291000000000   0.006082000000000   0.001117000000000;
   5.200000000000000   0.000632700000000   0.007100000000000   0.000782500000000;
   5.250000000000000   0.001096000000000   0.007932000000000   0.000572500000000;
   5.300000000000000   0.001655000000000   0.008620000000000   0.000421600000000;
   5.350000000000000   0.002257500000000   0.009148500000000   0.000298400000000;
   5.400000000000000   0.002904000000000   0.009540000000000   0.000203000000000;
   5.450000000000000   0.003597000000000   0.009803000000000   0.000134000000000;
   5.500000000000000   0.004334500000000   0.009949500000000   0.000087500000000;
   5.550000000000000   0.005120500000000   0.010000000000000   0.000057500000000;
   5.600000000000000   0.005945000000000   0.009950000000000   0.000039000000000;
   5.650000000000000   0.006784000000000   0.009786000000000   0.000027500000000;
   5.700000000000000   0.007621000000000   0.009520000000000   0.000021000000000;
   5.750000000000000   0.008425000000000   0.009154000000000   0.000018000000000;
   5.800000000000000   0.009163000000000   0.008700000000000   0.000016500000000;
   5.850000000000000   0.009786000000000   0.008163000000000   0.000014000000000;
   5.900000000000000   0.010263000000000   0.007570000000000   0.000011000000000;
   5.950000000000000   0.010567000000000   0.006949000000000   0.000010000000000;
   6.000000000000000   0.010622000000000   0.006310000000000   0.000008000000000;
   6.050000000000000   0.010456000000000   0.005668000000000   0.000006000000000;
   6.100000000000000   0.010026000000000   0.005030000000000   0.000003400000000;
   6.150000000000000   0.009384000000000   0.004412000000000   0.000002400000000;
   6.200000000000000   0.008544500000000   0.003810000000000   0.000001900000000;
   6.250000000000000   0.007514000000000   0.003210000000000   0.000001000000000;
   6.300000000000000   0.006424000000000   0.002650000000000   0.000000500000000;
   6.350000000000000   0.005419000000000   0.002170000000000   0.000000300000000;
   6.400000000000000   0.004479000000000   0.001750000000000   0.000000200000000;
   6.450000000000000   0.003608000000000   0.001382000000000   0.000000100000000;
   6.500000000000000   0.002835000000000   0.001070000000000                   0;
   6.550000000000000   0.002187000000000   0.000816000000000                   0;
   6.600000000000000   0.001649000000000   0.000610000000000                   0;
   6.650000000000000   0.001212000000000   0.000445800000000                   0;
   6.700000000000000   0.000874000000000   0.000320000000000                   0;
   6.750000000000000   0.000636000000000   0.000232000000000                   0;
   6.800000000000000   0.000467700000000   0.000170000000000                   0;
   6.850000000000000   0.000329000000000   0.000119200000000                   0;
   6.900000000000000   0.000227000000000   0.000082100000000                   0;
   6.950000000000000   0.000158400000000   0.000057230000000                   0;
   7.000000000000000   0.000113590000000   0.000041020000000                   0;
   7.050000000000000   0.000081110000000   0.000029290000000                   0;
   7.100000000000000   0.000057900000000   0.000020910000000                   0;
   7.150000000000000   0.000041090000000   0.000014840000000                   0;
   7.200000000000000   0.000028990000000   0.000010470000000                   0;
   7.250000000000000   0.000020490000000   0.000007400000000                   0;
   7.300000000000000   0.000014400000000   0.000005200000000                   0;
   7.350000000000000   0.000010000000000   0.000003610000000                   0;
   7.400000000000000   0.000006900000000   0.000002490000000                   0;
   7.450000000000000   0.000004760000000   0.000001720000000                   0;
   7.500000000000000   0.000003320000000   0.000001200000000                   0;
   7.550000000000000   0.000002350000000   0.000000850000000                   0;
   7.600000000000000   0.000001660000000   0.000000600000000                   0;
   7.650000000000000   0.000001170000000   0.000000420000000                   0;
   7.700000000000000   0.000000830000000   0.000000300000000                   0;
   7.750000000000000   0.000000590000000   0.000000210000000                   0;
   7.800000000000000   0.000000420000000   0.000000150000000                   0;];
cie.illE = ones(length(cie.lambda),1); %equal energy illuminant


%Interpolate data to specifed range
interpMethod = 'linear';
cie.cmf2deg = interp1(cie.cmf2deg(:,1),cie.cmf2deg(:,2:end),cie.lambda(:),interpMethod);



cie.cmf2deg=cie.cmf2deg';
locus = [cie.cmf2deg(1,:)./sum(cie.cmf2deg);cie.cmf2deg(2,:)./sum(cie.cmf2deg)];
plot(locus(1,[1:81,1]),locus(2,[1:81,1]), 'b-'); 

v = locus(1,[1:81,1]);
g = locus(2,[1:81,1]);
for ii = 1:81
    fprintf('(%f,%f)',v(ii)*10,g(ii)*10)
    fprintf('--')
    if mod(ii,10) == 0
        fprintf('\n')
    end
end

如果你从 Matlab 复制并粘贴,你会得到这个

\documentclass[]{article}
\usepackage{tikz}

\usetikzlibrary{fadings}
\usepackage[latin1]{inputenc}

\author{}
\date{}
\title{}

\begin{document}

\begin{tikzpicture}
    \draw [<->,ultra thick] (0,10) -- (0,0) -- (10,0);
    \draw [help lines] (0,0) grid (10,10);
    \draw [thick] (1.741123,0.049637)--(1.740078,0.049805)--(1.738008,0.049154)--(1.735599,0.049232)--(1.733369,0.047967)--(1.730210,0.047751)--(1.725766,0.047993)--(1.720866,0.048325)--(1.714074,0.051022)--(1.703010,0.057885)--
(1.688775,0.069002)--(1.668953,0.085556)--(1.644118,0.108576)--(1.611046,0.137934)--(1.566409,0.177048)--(1.509854,0.227402)--(1.439604,0.297030)--(1.355027,0.398791)--(1.241185,0.578025)--(1.095943,0.868425)--
(0.912935,1.327021)--(0.687059,2.007232)--(0.453907,2.949760)--(0.234599,4.127035)--(0.081680,5.384231)--(0.038585,6.548232)--(0.138702,7.501864)--(0.388518,8.120160)--(0.743024,8.338031)--(1.141607,8.262070)--
(1.547221,8.058635)--(1.928762,7.816291)--(2.296197,7.543291)--(2.657751,7.243239)--(3.016039,6.923077)--(3.373633,6.588483)--(3.731015,6.244509)--(4.087363,5.896069)--(4.440625,5.547139)--(4.787748,5.202023)--
(5.124864,4.865908)--(5.447865,4.544341)--(5.751513,4.242322)--(6.029328,3.964966)--(6.270366,3.724911)--(6.482331,3.513949)--(6.657636,3.340107)--(6.800788,3.197472)--(6.915040,3.083422)--(7.006061,2.993007)--
(7.079178,2.920271)--(7.140316,2.859289)--(7.190329,2.809350)--(7.230316,2.769484)--(7.259923,2.740077)--(7.282717,2.717283)--(7.299690,2.700310)--(7.310894,2.689106)--(7.319933,2.680067)--(7.327189,2.672811)--
(7.334170,2.665830)--(7.340473,2.659527)--(7.343902,2.656098)--(7.345917,2.654083)--(7.346873,2.653127)--(7.346920,2.653080)--(7.346783,2.653217)--(7.346683,2.653317)--(7.346680,2.653320)--(7.346719,2.653281)--
(7.346939,2.653061)--(7.347539,2.652461)--(7.348243,2.651757)--(7.345679,2.654321)--(7.345133,2.654867)--(7.343750,2.656250)--(7.345133,2.654867)--(7.358491,2.641509)--(7.345133,2.654867)--(7.375000,2.625000)--
(7.368421,2.631579)--cycle;
\end{tikzpicture}

\end{document}

在此处输入图片描述

这是我尝试使用代码为其着色时得到的结果

\documentclass[]{article}
\usepackage{tikz}

\usetikzlibrary{fadings}
\usepackage[latin1]{inputenc}

\author{}
\date{}
\title{}

\begin{document}
\begin{tikzpicture}
\draw [<->,ultra thick] (0,10) -- (0,0) -- (10,0);
\draw [help lines] (0,0) grid (10,10);
\fill [blue] (1.741123,0.049637)--(1.740078,0.049805)--(1.738008,0.049154)--

(1.735599,0.049232)--(1.733369,0.047967)--(1.730210,0.047751)--(1.725766,0.047993)--(1.720866,0.048325)--(1.714074,0.051022)--(1.703010,0.057885)--
(1.688775,0.069002)--(1.668953,0.085556)--(1.644118,0.108576)--(1.611046,0.137934)--(1.566409,0.177048)--(1.509854,0.227402)--(1.439604,0.297030)--(1.355027,0.398791)--(1.241185,0.578025)--(1.095943,0.868425)--
(0.912935,1.327021)--(0.687059,2.007232)--(0.453907,2.949760)--(0.234599,4.127035)--(0.081680,5.384231)--(0.038585,6.548232)--(0.138702,7.501864)--(0.388518,8.120160)--(0.743024,8.338031)--(1.141607,8.262070)--
(1.547221,8.058635)--(1.928762,7.816291)--(2.296197,7.543291)--(2.657751,7.243239)--(3.016039,6.923077)--(3.373633,6.588483)--(3.731015,6.244509)--(4.087363,5.896069)--(4.440625,5.547139)--(4.787748,5.202023)--
(5.124864,4.865908)--(5.447865,4.544341)--(5.751513,4.242322)--(6.029328,3.964966)--(6.270366,3.724911)--(6.482331,3.513949)--(6.657636,3.340107)--(6.800788,3.197472)--(6.915040,3.083422)--(7.006061,2.993007)--
(7.079178,2.920271)--(7.140316,2.859289)--(7.190329,2.809350)--(7.230316,2.769484)--(7.259923,2.740077)--(7.282717,2.717283)--(7.299690,2.700310)--(7.310894,2.689106)--(7.319933,2.680067)--(7.327189,2.672811)--
(7.334170,2.665830)--(7.340473,2.659527)--(7.343902,2.656098)--(7.345917,2.654083)--(7.346873,2.653127)--(7.346920,2.653080)--(7.346783,2.653217)--(7.346683,2.653317)--(7.346680,2.653320)--(7.346719,2.653281)--
(7.346939,2.653061)--(7.347539,2.652461)--(7.348243,2.651757)--(7.345679,2.654321)--(7.345133,2.654867)--(7.343750,2.656250)--(7.345133,2.654867)--(7.358491,2.641509)--(7.345133,2.654867)--(7.375000,2.625000)--
(7.368421,2.631579)--cycle;
    \fill [red, path fading =west] (1.741123,0.049637)--(1.740078,0.049805)--(1.738008,0.049154)--(1.735599,0.049232)--(1.733369,0.047967)--(1.730210,0.047751)--(1.725766,0.047993)--(1.720866,0.048325)--(1.714074,0.051022)--(1.703010,0.057885)--
(1.688775,0.069002)--(1.668953,0.085556)--(1.644118,0.108576)--(1.611046,0.137934)--(1.566409,0.177048)--(1.509854,0.227402)--(1.439604,0.297030)--(1.355027,0.398791)--(1.241185,0.578025)--(1.095943,0.868425)--
(0.912935,1.327021)--(0.687059,2.007232)--(0.453907,2.949760)--(0.234599,4.127035)--(0.081680,5.384231)--(0.038585,6.548232)--(0.138702,7.501864)--(0.388518,8.120160)--(0.743024,8.338031)--(1.141607,8.262070)--
(1.547221,8.058635)--(1.928762,7.816291)--(2.296197,7.543291)--(2.657751,7.243239)--(3.016039,6.923077)--(3.373633,6.588483)--(3.731015,6.244509)--(4.087363,5.896069)--(4.440625,5.547139)--(4.787748,5.202023)--
(5.124864,4.865908)--(5.447865,4.544341)--(5.751513,4.242322)--(6.029328,3.964966)--(6.270366,3.724911)--(6.482331,3.513949)--(6.657636,3.340107)--(6.800788,3.197472)--(6.915040,3.083422)--(7.006061,2.993007)--
(7.079178,2.920271)--(7.140316,2.859289)--(7.190329,2.809350)--(7.230316,2.769484)--(7.259923,2.740077)--(7.282717,2.717283)--(7.299690,2.700310)--(7.310894,2.689106)--(7.319933,2.680067)--(7.327189,2.672811)--
(7.334170,2.665830)--(7.340473,2.659527)--(7.343902,2.656098)--(7.345917,2.654083)--(7.346873,2.653127)--(7.346920,2.653080)--(7.346783,2.653217)--(7.346683,2.653317)--(7.346680,2.653320)--(7.346719,2.653281)--
(7.346939,2.653061)--(7.347539,2.652461)--(7.348243,2.651757)--(7.345679,2.654321)--(7.345133,2.654867)--(7.343750,2.656250)--(7.345133,2.654867)--(7.358491,2.641509)--(7.345133,2.654867)--(7.375000,2.625000)--
(7.368421,2.631579)--cycle;
    \fill [green,path fading =south] (1.741123,0.049637)--(1.740078,0.049805)--(1.738008,0.049154)--(1.735599,0.049232)--(1.733369,0.047967)--(1.730210,0.047751)--(1.725766,0.047993)--(1.720866,0.048325)--(1.714074,0.051022)--(1.703010,0.057885)--
(1.688775,0.069002)--(1.668953,0.085556)--(1.644118,0.108576)--(1.611046,0.137934)--(1.566409,0.177048)--(1.509854,0.227402)--(1.439604,0.297030)--(1.355027,0.398791)--(1.241185,0.578025)--(1.095943,0.868425)--
(0.912935,1.327021)--(0.687059,2.007232)--(0.453907,2.949760)--(0.234599,4.127035)--(0.081680,5.384231)--(0.038585,6.548232)--(0.138702,7.501864)--(0.388518,8.120160)--(0.743024,8.338031)--(1.141607,8.262070)--
(1.547221,8.058635)--(1.928762,7.816291)--(2.296197,7.543291)--(2.657751,7.243239)--(3.016039,6.923077)--(3.373633,6.588483)--(3.731015,6.244509)--(4.087363,5.896069)--(4.440625,5.547139)--(4.787748,5.202023)--
(5.124864,4.865908)--(5.447865,4.544341)--(5.751513,4.242322)--(6.029328,3.964966)--(6.270366,3.724911)--(6.482331,3.513949)--(6.657636,3.340107)--(6.800788,3.197472)--(6.915040,3.083422)--(7.006061,2.993007)--
(7.079178,2.920271)--(7.140316,2.859289)--(7.190329,2.809350)--(7.230316,2.769484)--(7.259923,2.740077)--(7.282717,2.717283)--(7.299690,2.700310)--(7.310894,2.689106)--(7.319933,2.680067)--(7.327189,2.672811)--
(7.334170,2.665830)--(7.340473,2.659527)--(7.343902,2.656098)--(7.345917,2.654083)--(7.346873,2.653127)--(7.346920,2.653080)--(7.346783,2.653217)--(7.346683,2.653317)--(7.346680,2.653320)--(7.346719,2.653281)--
(7.346939,2.653061)--(7.347539,2.652461)--(7.348243,2.651757)--(7.345679,2.654321)--(7.345133,2.654867)--(7.343750,2.656250)--(7.345133,2.654867)--(7.358491,2.641509)--(7.345133,2.654867)--(7.375000,2.625000)--
(7.368421,2.631579)--cycle;
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

免责声明:我不是彩色宝石这是我第一次接触比色法。请注意。

解决您的问题的一种优雅方法是函数着色。它允许一种非常通用的解决方案,可以轻松调整以适应其他类似问题(阅读:其他颜色空间)。

仔细检查后,您的数据集似乎很乱,所以我将忽略它并使用更干净的数据集。

我参考了 CIE 1931 获取色度数据,并写下了每个数据集的来源。

我花了一些时间编写了一些可能引起普遍兴趣的简单的 4 类辅助函数。

有趣的部分相对较短,位于底部:

\documentclass{standalone}
\usepackage{tikz}

% ------------------------------------------------------------------- RAW DATA

% DATASET ORIGIN:
%  http://steve.hollasch.net/cgindex/color/freq-rgb.html
% Spectral stimuli colors - CIE 1931
\def\spectralLocus{ % xy coordinates from 390nm to 700nm in steps of 5nm
  (0.1738,0.0049)(0.1736,0.0049)(0.1733,0.0048)(0.1730,0.0048)(0.1726,0.0048)
  (0.1721,0.0048)(0.1714,0.0051)(0.1703,0.0058)(0.1689,0.0069)(0.1669,0.0086)
  (0.1644,0.0109)(0.1611,0.0138)(0.1566,0.0177)(0.1510,0.0227)(0.1440,0.0297)
  (0.1355,0.0399)(0.1241,0.0578)(0.1096,0.0868)(0.0913,0.1327)(0.0687,0.2007)
  (0.0454,0.2950)(0.0235,0.4127)(0.0082,0.5384)(0.0039,0.6548)(0.0139,0.7502)
  (0.0389,0.8120)(0.0743,0.8338)(0.1142,0.8262)(0.1547,0.8059)(0.1929,0.7816)
  (0.2296,0.7543)(0.2658,0.7243)(0.3016,0.6923)(0.3373,0.6589)(0.3731,0.6245)
  (0.4087,0.5896)(0.4441,0.5547)(0.4788,0.5202)(0.5125,0.4866)(0.5448,0.4544)
  (0.5752,0.4242)(0.6029,0.3965)(0.6270,0.3725)(0.6482,0.3514)(0.6658,0.3340)
  (0.6801,0.3197)(0.6915,0.3083)(0.7006,0.2993)(0.7079,0.2920)(0.7140,0.2859)
  (0.7190,0.2809)(0.7230,0.2770)(0.7260,0.2740)(0.7283,0.2717)(0.7300,0.2700)
  (0.7311,0.2689)(0.7320,0.2680)(0.7327,0.2673)(0.7334,0.2666)(0.7340,0.2660)
  (0.7344,0.2656)(0.7346,0.2654)(0.7347,0.2653)}

% DATASET ORIGIN:
%  http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html
% Blackbody colors - CIE 1931
\def\planckianLocus{ % xy coordinates from 1000K to 40000K in steps of 100K
  (0.6499,0.3474)(0.6361,0.3594)(0.6226,0.3703)(0.6095,0.3801)(0.5966,0.3887)
  (0.5841,0.3962)(0.5720,0.4025)(0.5601,0.4076)(0.5486,0.4118)(0.5375,0.4150)
  (0.5267,0.4173)(0.5162,0.4188)(0.5062,0.4196)(0.4965,0.4198)(0.4872,0.4194)
  (0.4782,0.4186)(0.4696,0.4173)(0.4614,0.4158)(0.4535,0.4139)(0.4460,0.4118)
  (0.4388,0.4095)(0.4320,0.4070)(0.4254,0.4044)(0.4192,0.4018)(0.4132,0.3990)
  (0.4075,0.3962)(0.4021,0.3934)(0.3969,0.3905)(0.3919,0.3877)(0.3872,0.3849)
  (0.3827,0.3820)(0.3784,0.3793)(0.3743,0.3765)(0.3704,0.3738)(0.3666,0.3711)
  (0.3631,0.3685)(0.3596,0.3659)(0.3563,0.3634)(0.3532,0.3609)(0.3502,0.3585)
  (0.3473,0.3561)(0.3446,0.3538)(0.3419,0.3516)(0.3394,0.3494)(0.3369,0.3472)
  (0.3346,0.3451)(0.3323,0.3431)(0.3302,0.3411)(0.3281,0.3392)(0.3261,0.3373)
  (0.3242,0.3355)(0.3223,0.3337)(0.3205,0.3319)(0.3188,0.3302)(0.3171,0.3286)
  (0.3155,0.3270)(0.3140,0.3254)(0.3125,0.3238)(0.3110,0.3224)(0.3097,0.3209)
  (0.3083,0.3195)(0.3070,0.3181)(0.3058,0.3168)(0.3045,0.3154)(0.3034,0.3142)
  (0.3022,0.3129)(0.3011,0.3117)(0.3000,0.3105)(0.2990,0.3094)(0.2980,0.3082)
  (0.2970,0.3071)(0.2961,0.3061)(0.2952,0.3050)(0.2943,0.3040)(0.2934,0.3030)
  (0.2926,0.3020)(0.2917,0.3011)(0.2910,0.3001)(0.2902,0.2992)(0.2894,0.2983)
  (0.2887,0.2975)(0.2880,0.2966)(0.2873,0.2958)(0.2866,0.2950)(0.2860,0.2942)
  (0.2853,0.2934)(0.2847,0.2927)(0.2841,0.2919)(0.2835,0.2912)(0.2829,0.2905)
  (0.2824,0.2898)(0.2818,0.2891)(0.2813,0.2884)(0.2807,0.2878)(0.2802,0.2871)
  (0.2797,0.2865)(0.2792,0.2859)(0.2788,0.2853)(0.2783,0.2847)(0.2778,0.2841)
  (0.2774,0.2836)(0.2770,0.2830)(0.2765,0.2825)(0.2761,0.2819)(0.2757,0.2814)
  (0.2753,0.2809)(0.2749,0.2804)(0.2745,0.2799)(0.2742,0.2794)(0.2738,0.2789)
  (0.2734,0.2785)(0.2731,0.2780)(0.2727,0.2776)(0.2724,0.2771)(0.2721,0.2767)
  (0.2717,0.2763)(0.2714,0.2758)(0.2711,0.2754)(0.2708,0.2750)(0.2705,0.2746)
  (0.2702,0.2742)(0.2699,0.2738)(0.2696,0.2735)(0.2694,0.2731)(0.2691,0.2727)
  (0.2688,0.2724)(0.2686,0.2720)(0.2683,0.2717)(0.2680,0.2713)(0.2678,0.2710)
  (0.2675,0.2707)(0.2673,0.2703)(0.2671,0.2700)(0.2668,0.2697)(0.2666,0.2694)
  (0.2664,0.2691)(0.2662,0.2688)(0.2659,0.2685)(0.2657,0.2682)(0.2655,0.2679)
  (0.2653,0.2676)(0.2651,0.2673)(0.2649,0.2671)(0.2647,0.2668)(0.2645,0.2665)
  (0.2643,0.2663)(0.2641,0.2660)(0.2639,0.2657)(0.2638,0.2655)(0.2636,0.2652)
  (0.2634,0.2650)(0.2632,0.2648)(0.2631,0.2645)(0.2629,0.2643)(0.2627,0.2641)
  (0.2626,0.2638)(0.2624,0.2636)(0.2622,0.2634)(0.2621,0.2632)(0.2619,0.2629)
  (0.2618,0.2627)(0.2616,0.2625)(0.2615,0.2623)(0.2613,0.2621)(0.2612,0.2619)
  (0.2610,0.2617)(0.2609,0.2615)(0.2608,0.2613)(0.2606,0.2611)(0.2605,0.2609)
  (0.2604,0.2607)(0.2602,0.2606)(0.2601,0.2604)(0.2600,0.2602)(0.2598,0.2600)
  (0.2597,0.2598)(0.2596,0.2597)(0.2595,0.2595)(0.2593,0.2593)(0.2592,0.2592)
  (0.2591,0.2590)(0.2590,0.2588)(0.2589,0.2587)(0.2588,0.2585)(0.2587,0.2584)
  (0.2586,0.2582)(0.2584,0.2580)(0.2583,0.2579)(0.2582,0.2577)(0.2581,0.2576)
  (0.2580,0.2574)(0.2579,0.2573)(0.2578,0.2572)(0.2577,0.2570)(0.2576,0.2569)
  (0.2575,0.2567)(0.2574,0.2566)(0.2573,0.2565)(0.2572,0.2563)(0.2571,0.2562)
  (0.2571,0.2561)(0.2570,0.2559)(0.2569,0.2558)(0.2568,0.2557)(0.2567,0.2555)
  (0.2566,0.2554)(0.2565,0.2553)(0.2564,0.2552)(0.2564,0.2550)(0.2563,0.2549)
  (0.2562,0.2548)(0.2561,0.2547)(0.2560,0.2546)(0.2559,0.2545)(0.2559,0.2543)
  (0.2558,0.2542)(0.2557,0.2541)(0.2556,0.2540)(0.2556,0.2539)(0.2555,0.2538)
  (0.2554,0.2537)(0.2553,0.2536)(0.2553,0.2535)(0.2552,0.2534)(0.2551,0.2533)
  (0.2551,0.2532)(0.2550,0.2531)(0.2549,0.2530)(0.2548,0.2529)(0.2548,0.2528)
  (0.2547,0.2527)(0.2546,0.2526)(0.2546,0.2525)(0.2545,0.2524)(0.2544,0.2523)
  (0.2544,0.2522)(0.2543,0.2521)(0.2543,0.2520)(0.2542,0.2519)(0.2541,0.2518)
  (0.2541,0.2517)(0.2540,0.2516)(0.2540,0.2516)(0.2539,0.2515)(0.2538,0.2514)
  (0.2538,0.2513)(0.2537,0.2512)(0.2537,0.2511)(0.2536,0.2511)(0.2535,0.2510)
  (0.2535,0.2509)(0.2534,0.2508)(0.2534,0.2507)(0.2533,0.2507)(0.2533,0.2506)
  (0.2532,0.2505)(0.2532,0.2504)(0.2531,0.2503)(0.2531,0.2503)(0.2530,0.2502)
  (0.2530,0.2501)(0.2529,0.2500)(0.2529,0.2500)(0.2528,0.2499)(0.2528,0.2498)
  (0.2527,0.2497)(0.2527,0.2497)(0.2526,0.2496)(0.2526,0.2495)(0.2525,0.2495)
  (0.2525,0.2494)(0.2524,0.2493)(0.2524,0.2493)(0.2523,0.2492)(0.2523,0.2491)
  (0.2523,0.2491)(0.2522,0.2490)(0.2522,0.2489)(0.2521,0.2489)(0.2521,0.2488)
  (0.2520,0.2487)(0.2520,0.2487)(0.2519,0.2486)(0.2519,0.2485)(0.2519,0.2485)
  (0.2518,0.2484)(0.2518,0.2484)(0.2517,0.2483)(0.2517,0.2482)(0.2517,0.2482)
  (0.2516,0.2481)(0.2516,0.2481)(0.2515,0.2480)(0.2515,0.2480)(0.2515,0.2479)
  (0.2514,0.2478)(0.2514,0.2478)(0.2513,0.2477)(0.2513,0.2477)(0.2513,0.2476)
  (0.2512,0.2476)(0.2512,0.2475)(0.2512,0.2474)(0.2511,0.2474)(0.2511,0.2473)
  (0.2511,0.2473)(0.2510,0.2472)(0.2510,0.2472)(0.2509,0.2471)(0.2509,0.2471)
  (0.2509,0.2470)(0.2508,0.2470)(0.2508,0.2469)(0.2508,0.2469)(0.2507,0.2468)
  (0.2507,0.2468)(0.2507,0.2467)(0.2506,0.2467)(0.2506,0.2466)(0.2506,0.2466)
  (0.2505,0.2465)(0.2505,0.2465)(0.2505,0.2464)(0.2505,0.2464)(0.2504,0.2463)
  (0.2504,0.2463)(0.2504,0.2463)(0.2503,0.2462)(0.2503,0.2462)(0.2503,0.2461)
  (0.2502,0.2461)(0.2502,0.2460)(0.2502,0.2460)(0.2502,0.2459)(0.2501,0.2459)
  (0.2501,0.2459)(0.2501,0.2458)(0.2500,0.2458)(0.2500,0.2457)(0.2500,0.2457)
  (0.2500,0.2456)(0.2499,0.2456)(0.2499,0.2456)(0.2499,0.2455)(0.2498,0.2455)
  (0.2498,0.2454)(0.2498,0.2454)(0.2498,0.2454)(0.2497,0.2453)(0.2497,0.2453)
  (0.2497,0.2452)(0.2497,0.2452)(0.2496,0.2452)(0.2496,0.2451)(0.2496,0.2451)
  (0.2496,0.2450)(0.2495,0.2450)(0.2495,0.2450)(0.2495,0.2449)(0.2495,0.2449)
  (0.2494,0.2449)(0.2494,0.2448)(0.2494,0.2448)(0.2494,0.2447)(0.2493,0.2447)
  (0.2493,0.2447)(0.2493,0.2446)(0.2493,0.2446)(0.2492,0.2446)(0.2492,0.2445)
  (0.2492,0.2445)(0.2492,0.2445)(0.2491,0.2444)(0.2491,0.2444)(0.2491,0.2444)
  (0.2491,0.2443)(0.2491,0.2443)(0.2490,0.2443)(0.2490,0.2442)(0.2490,0.2442)
  (0.2490,0.2442)(0.2489,0.2441)(0.2489,0.2441)(0.2489,0.2441)(0.2489,0.2440)
  (0.2489,0.2440)(0.2488,0.2440)(0.2488,0.2439)(0.2488,0.2439)(0.2488,0.2439)
  (0.2487,0.2438)}

% ---------------------------------------------- sRGB COLORSPACE SPECIFICATION

% DATASET ORIGIN: http://www.color.org/sRGB.xalter

% CIE chromaticities for ITU-R BT.709 reference primaries
\def\primariesLoci{
  (0.6400,0.3300)  % R
  (0.3000,0.6000)  % G
  (0.1500,0.0600)} % B

% CIE standard illuminant D65
\def\whitepointLocus{
  (0.3127,0.3290)}

% Derived transformation matrix
\def\XYZtoRGB{
  { 3.2410}{-1.5374}{-0.4986}
  {-0.9692}{ 1.8760}{ 0.0416}
  { 0.0556}{-0.2040}{ 1.0570}}

 % Linear color to gamma corrected transform
\def\gammaCorrect{
  dup 0.0031308 le                    % if < 0.0031308
  {12.92 mul}                         % then linear transform
  {1 2.4 div exp 1.055 mul -0.055 add}% else power transform
  ifelse }

% ------------------------------------------------------------- TYPE 4 HELPERS

\def\scalarProduct#1#2#3{
  #3 mul     exch
  #2 mul add exch
  #1 mul add }

\def\applyMatrix#1#2#3#4#5#6#7#8#9{
  3 copy 3 copy
  \scalarProduct{#7}{#8}{#9} 7 1 roll
  \scalarProduct{#4}{#5}{#6} 5 1 roll
  \scalarProduct{#1}{#2}{#3} 3 1 roll }

\def\xyYtoXYZ{                        % x y Y
  3 copy 3 1 roll                     % x y Y Y x y
  add neg 1 add mul 2 index div       % x y Y Y*(-(x+y)+1)/y=Z
  4 1 roll                            % Z x y Y
  dup                                 % Z x y Y Y=Y
  5 1 roll                            % Y Z x y Y
  3 2 roll                            % Y Z y Y x
  mul exch div                        % Y Z Y*x/y=X
  3 1 roll }                          % X Y Z

\def\gammaCorrectVector{
  \gammaCorrect 3 1 roll
  \gammaCorrect 3 1 roll
  \gammaCorrect 3 1 roll}

% -------------------------------------------------------------------- DRAWING

\begin{document}
\begin{tikzpicture}

\pgfdeclarefunctionalshading{colorspace}
  {\pgfpointorigin}{\pgfpoint{1000bp}{1000bp}}{}{
    1000 div exch 1000 div exch       % x y   (chromaticity)
    1.0                               % x y Y (chromaticity+luminance)
    \xyYtoXYZ                         % X Y Z (XYZ)
    \expandafter\applyMatrix\XYZtoRGB % R G B (sRGB linear)
    \gammaCorrectVector }             % R G B (sRGB gamma corrected)

\begin{scope} [shift={(-500bp,-500bp)}, scale=100bp/1cm]
  % Background + viewport
  \fill [black] (-1,-1) rectangle (11,11);
  % xy grid
  \draw [dashed, gray] grid (10,10);
  \begin{scope} [scale=10]
    % Spectral locus marks
    \path [mark=*, mark repeat=2, white] 
      plot [mark size=0.10, mark phase=1] coordinates {\spectralLocus}
      plot [mark size=0.05, mark phase=2] coordinates {\spectralLocus};
    % Smooth spectral locus contour for clipping
    \clip [smooth] plot coordinates {\spectralLocus} -- cycle;
    % sRGB color space
    \pgfuseshading{colorspace}
    % Standard illuminant mark
    \draw [gray] \whitepointLocus circle (0.005);
    % Reference primaries gamut
    \fill [black, even odd rule, opacity=0.5]
      rectangle +(1,1) plot coordinates {\primariesLoci} -- cycle;
    % Planckian locus markings
    \path [mark=*,gray]
      plot [mark size=0.05, mark repeat=10] coordinates {\planckianLocus}
      plot [mark size=0.01, mark repeat=1 ] coordinates {\planckianLocus};
  \end{scope}
\end{scope}

\end{tikzpicture}
\end{document}

结果如下:

哇!太酷了!

图像相当大,因此建议您打开并放大。

网格是色度领域的刻度。

正如您所看到的,我还沿着光谱轨迹(白色,从 390nm 到 700nm,每 5nm 一个细刻度,每 10nm 一个粗刻度)和​​普朗克轨迹(灰色,从 1000K 到 40000K,每 100K 一个细刻度,每 1000K 一个粗刻度)绘制了刻度。

如果我的色度测定法正确,这是 sRGB 色彩空间的全亮度色度图,带有伽马校正。三角形是 ITU-R BT.709 参考原色的色域。光源是标准 D65,用灰色圆圈标记。

相关内容