title: How to plot colors on CIE 1931 Color Space in Matlab?
body: <p>I'm trying to plot few color values (co-ordinates) on the already plotted CIE 1931 color space. I've derived the XYZ color values which I want to plot, denoted as <code>[X, Y, Z]</code>- </p>
  
  <p><code>[50, 57, 10]</code>
  <code>[36, 43, 15]</code>
  <code>[28, 36, 8]</code>
  <code>[25, 32, 14]</code></p>
  
  <p>I using this function which plots the entire CIE color space - 
  <a href="http://www.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e/content//cieplot.m" rel="nofollow noreferrer">http://www.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e/content//cieplot.m</a></p>
  
  <pre><code> cieplot();
   hold on
   x=[0.42 0.58]
   y=[0.48 0.45];
   scatter(x,y);
   hold off
  </code></pre>
  
  <p>I've used the below two formulas for calculating the <code>x</code> and <code>y</code> values used in the above code to plot 2 colors as an example and it generates the figure/graph shown. One of the 2 colors goes outside the desired color spectrum. I'm confused as to how to plot <code>z</code> coordinate which can be calculated as <code>z=1-x-y</code> on the shown CIE color space, so that all the colors fit within the spectrum.</p>
  
  <p><img src="https://i.stack.imgur.com/fQOjB.png" alt="Formula to calculate x"></p>
  
  <p><img src="https://i.stack.imgur.com/LdKuk.png" alt="Formula to calculate y"></p>
  
  <p><img src="https://i.stack.imgur.com/2MjbR.jpg" alt="Generated Plot/Figure"></p>