frudawski

# plotcieuv

The plotcieuv function plots the CIE 1960 u and v chromaticity diagram. Any errors in the data set or in results generated with the Lighting Toolbox are not in the liability of the CIE nor me, see licence.

Note 1:

The plot consists of an background image of 1000 \times 1000 pixels with an inverse v-axis. For additional plotting with the hold command one need to adjust the u and v coordinates accordingly, see also last example:

u = u.*1000;
v = 1000-v.*1000;

Note 2:

In Octave the plotcieuv function runs significantly faster using the image package. Consider installing and loading the image package before using the cieplotuv function. It will work without it though.

Install package:

pkg install image

pkg load image

By adding the load command to the .octaverc file, octave will load the toolbox automatically at startup.

Note 3:

The plotcieuv function just calls another function named cie1960 which contains the actual code to plot the diagram. I have done this in the sake of a better function name but at the same time backwards compability for my own code.

Usage:

plotcieuv(u,v,'parameter','value')

Where:

Examples

Plot CIE 1960 u and v chromaticity diagram:

plotcieuv

Result:

Plot data in CIE 1960 u and v chromaticity diagram:

u = 0.20;
v = 0.15;
plotcieuv(u,v)

Result:

Plot data in CIE 1960 u and v chromaticity diagram with specified marker and extended legend:

u = 0.2056;
v = 0.3456;
plotcieuv(u,v,'marker','x','markercolor','k',...
'markersize',4,'legendmode','extended')

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with legend:

u = linspace(0.1,0.2,5);
v = linspace(0.3,0.2,5);
plotcieuv(u,v,'legendmode','on')

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with different marker and colours:

u = linspace(0.1,0.2,5);
v = linspace(0.3,0.2,5);
c = colours(5);
plotcieuv(u,v,'marker','.','markercolor',c,...
'markersize',8,'legendmode','on')

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with planckian locus and CCT range:

u = linspace(0.2,0.3,5);
v = linspace(0.30,0.35,5);
plotcieuv(u,v,'markercolor',[1 0 0],...
'planck','on','CCT','range')

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with planckian locus and isotemperature lines:

u = linspace(0.17,0.29,5);
v = linspace(0.31,0.35,5);
plotcieuv(u,v,'marker','.','markercolor',[1 0 0],...
'planck','on','CCT','value')

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with planckian locus and isotemperature lines and zoom to certain region:

u = linspace(0.17,0.29,5);
v = linspace(0.31,0.35,5);
plotcieuv(u,v,'marker','x','markercolor',...
[1 0 0],'planck','on','CCT','value','zoom',[0.10 0.35 0.25 0.45])

Result:

Plot several data points in CIE 1960 u and v chromaticity diagram with planckian locus and additional isotemperature lines:

u = linspace(0.17,0.25,5);
v = linspace(0.31,0.35,5);
iso = [2700 15000 25000];
plotcieuv(u,v,'planck','on','CCT','value','isotemplines',iso)

Result:

Plot data in CIE 1960 u and v chromaticity diagram using x and y input:

x = 0.3130;
y = 0.2404;
plotcieuv(x,y,'input','xy','legendmode','on')

Result:

Plot data in CIE 1960 u and v chromaticity diagram without colour:

u = 0.3456;
v = 0.2456;
plotcieuv(u,v,'Color','off')

Result:

Plot data in CIE 1960 u and v chromaticity diagram on black background:

plotcieuv(0.3,0.3,'Background','black')

Result:

Plot CIE 1960 u and v chromaticity diagram with with no data points but Planckian and daylight locus:

plotcieuv(NaN,NaN,'Planck','on','DaylightLocus','on')

Result:

Plot CIE 1960 u and v chromaticity diagram with whitepoint ‘D65’ and add srgb colour space gamut:

plotcieuv(NaN,NaN,'whitepoints','D65')
hold on
% srgb colour space gamut according to https://en.wikipedia.org/wiki/SRGB
x = [0.64 0.30 0.15 0.64];
y = [0.33 0.60 0.06 0.33];
% transform to u and v
[u,v] = ciexy2uv(x,y);
% transform data for plot on image
u = u.*1000;
v = 1000-v.*1000;
% plot srgb colour space gamut
plot(u,v,'k')
title('srgb colour space gamut')
hold off

David Lewis MacAdam: Projective Transformations of I. C. I. Color Specifications. In: Journal of the Optical Society of America, vol. 27, no. 8, pp. 294-299, 1937, (DOI: 10.1364/JOSA.27.000294).
CIE 15:2018: Colorimetry, 4th Edition. Commission International de l’Éclairage (CIE), Vienna Austria, 2018, ISBN: 978-3-902842-13-8 , (DOI: 10.25039/TR.015.2018).