frudawski

# plotciexy

The plotciexy function plots the CIE 1931 x and y chromaticity diagram.

Note 1:

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

x = x.*1000;
y = 1000-y.*1000;

Note 2:

In Octave the plotciexy function runs significantly faster using the image package. Consider installing and loading the image package before using the cieplotxy 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 plotciexy function just calls another function named cie1931 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:

plotciexy(x,y,'parameter','value')

Where:

Examples

Plot CIE 1931 x and y chromaticity diagram:

plotciexy

Result:

Plot data in CIE 1931 x and y chromaticity diagram:

x = 0.3456;
y = 0.2456;
plotciexy(x,y)

Result:

Plot data in CIE 1931 x and y chromaticity diagram with specified marker with extended legend:

x = 0.3456;
y = 0.2456;
plotciexy(x,y,'marker','x','markercolor','k',...
'markersize',4,'legendmode','extended')

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with legend:

x = linspace(0.2,0.3,5);
y = linspace(0.2,0.3,5);
plotciexy(x,y,'legendmode','on')

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with different marker and colours:

x = linspace(0.2,0.3,5);
y = linspace(0.2,0.3,5);
c = colours(5);
plotciexy(x,y,'marker','.','markercolor',c,...
'markersize',8,'legendmode','on')

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with planckian locus and CCT range:

x = linspace(0.3,0.4,5);
y = linspace(0.3,0.4,5);
plotciexy(x,y,'markercolor',[1 0 0],'planck','on','CCT','range')

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with planckian locus and isotemperature lines:

x = linspace(0.3,0.4,5);
y = linspace(0.3,0.375,5);
plotciexy(x,y,'marker','.','markercolor',[1 0 0],...
'planck','on','CCT','value')

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with planckian locus and isotemperature lines and zoom to certain region:

x = linspace(0.3,0.4,5);
y = linspace(0.3,0.375,5);
plotciexy(x,y,'marker','.','markercolor',...
[1 0 0],'planck','on','CCT','value','zoom',[0.25 0.45 0.25 0.47])

Result:

Plot several data points in CIE 1931 x and y chromaticity diagram with planckian locus and additional isotemperature lines:

x = linspace(0.3,0.4,5);
y = linspace(0.3,0.375,5);
iso = [2700 15000 25000];
plotciexy(x,y,'planck','on','CCT','value','isotemplines',iso)

Result:

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

u = 0.2630;
v = 0.2004;
plotciexy(u,v,'input','uv')

Result:

Plot data in CIE 1931 x and y chromaticity diagram without colour:

x = 0.3456;
y = 0.2456;
plotciexy(x,y,'Color','off')

Result:

Plot data in CIE 1931 x and y chromaticity diagram on black background:

plotciexy(0.3,0.4,'Background','black')

Result:

Plot CIE 1931 x and y chromaticity diagram with with no data points but Planckian and daylight locus:

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

Result:

Plot CIE 1931 x and y chromaticity diagram with whitepoint ‘D65’ and add srgb colour space gamut:

plotciexy(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 data for plot on image
x = x.*1000;
y = 1000-y.*1000;
% plot srgb colour space gamut
plot(x,y,'k')
title('srgb colour space gamut')
hold off

Result: