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

Load package:

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:

ParameterDescription
u and vAre the to be plotted CIE 1960 u and v chromaticity coordinates. For an empty chromaticity diagram use an emtpy function call: plotciexy, plotciexy() or plotciexy(NaN,NaN)
'input'‘uv’ for CIE 1960 u and v chromaticity coordinates (default)
‘xy’ for CIE 1931 x and y chromaticity coordinates which are transormed to u and v automaticly
'color'‘on’ for plotting the diagram filled with the acording colours (default)
‘off’ for plotting the diagram without colours
'background'‘white’ for white background (default)
‘black’ for black background
'marker'Marker for the given chromaticity coordinates:
‘+’ (default), ‘o’ , ‘*’ , ‘.’ , ‘x’ , ‘s’ , ‘d’ , ‘^’ , ‘v’ , ‘>’ , ‘<‘ , ‘p’ , ‘h’ , ‘square’ , ‘diamond’ , ‘pentagram’ , ‘hexagram’
'markercolor'Color of the plotted chromaticity markers, default is the standard colour order:
1\times 3 vector or standard colour shortcuts (e.g. ‘b’,’r’,’g’,’c’,’y’,’k’) for uniform [r g b] marker colour
n\times 3 [r g b] matrix for n different marker colours
'markersize'Size of the plotted chromaticity markers, numeric:
default = 1
'whitepoints'Plots additional whitepoints of standard illuminants into the diagram:
see: ciewhitepoint
For several whitepoints use an cell array: {‘A’,’E’,’D65′,…}
'planck'‘on’ plots the Plancian Locus into the diagram
‘off’ default
'CCT'‘off’ default
Plankian Locus must be enabled for the following options:
‘value’ plots an isotemperature line for each given input coordinate
‘range’ plots the lowest and highest isotemperature line for the given coordinates
'isotemplines'Plankian Locus must be enabled for the option
Plots additional isotemperature lines:
[Tcp1 Tcp2 … Tcpn]
'daylightlocus'‘on’ plots the Daylight Locus int the diagram
‘off’ default
'legendmode'‘off’ default
‘on’ shows a legend of the given chromaticity coordinates
‘extended’ shows a legend of the given chromaticity coordinates and corresponding CCT
'grid'‘on’ plots grid lines in the diagram (default)
‘off’
'fontsize'Fontsize of text, numeric, default = 8
'zoom'Zooms into a certain region of the diagram, numeric vector [x1 x2 y1 y2]
default = [0 0.8 0 0.9]

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')

See also: colours

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

See also: ciexy2uv

Result:

Reference

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).

Leave a comment

* I accept the use of cookies as well as the terms in the privacy policy. I accept that data provided by me is processed and saved. I know that comments are saved and published after review.