scatter3 -- plotting points with different colors attributes

I would like to explore a different approach with my scatter3 plotting project.
So far, I'm using a custom data tip to identify numerically colors (3D points) that are outside the gamut of my output device :
As you can see, there are points that clearly lie outside the 3D volume of the 'destination gamut'. For example, the data point shown above is 10.3511. Now, I'd to explore the possibility of adding a 'white outline' to those points, to further drive home the idea that they are out of gamut, for my students. What would be my best approach?
I was thinking, perhaps, to construct a loop to sub-select all the point that have less than, say, 1 DeltaE, and store them in a 'inGamut' array. And sending the rest in an 'outGamut' array, and use two calls to scatter3; one call for the inGamut points, followed by a second call, where I would specify additional attribute such as "outline" (or stroke -- don't know how it's called in Matlab) for the outGamut points.
It's either than or go through all the points in a loop and have them plotted differently depending on their DeltaE value.
Which would be a good (easiest) approach?

Answers (1)

The first option sounds the closest to what I would do, except that I see no reason to use a loop. Just use logical indexing:
in=DE76<1; out=~in;
inGammut={X(in), Y(in), Z(in)};
outGammut={X(out), Y(out), Z(out)};
hold on
scatter3(inGammut{:},80,RGB,'filled');
scatter3(outGammut{:},_____);
hold off

5 Comments

Thank you Matt,
I experimented with a loop and, boy!, did that take forever :-) I had to interrupt execution...
Is the first line above some kind of pseudocode? I never seen this notation.
I confess my ignorance in Matlab... So far, I managed to get this far :
DE76reshape = reshape(DE76, [12, 1])
myTable = table(Lab(1,:)', Lab(2,:)',Lab(3,:)', DE76reshape)
inGamutTable = myTable(myTable.DE76reshape < 1,:)
First, as you can see, the DE76 was a 4 x 3 array. So I converted it to a column vector. Then I created a table made up of the three column vectors from my Lab array (which I transposed with the apostrophe operator) plus the DE76 column vector. At that point, I extracted the colors meeting my criteria using the third statement above.
The table has only value in finding colors that have than 1 DeltaE value. But once I get that table, then I need to turn it back into compatible arguments for the scatter3 function... Which I'm having difficulty with...
You don't need the table at all. The only pseudocode in what I had above is the 2nd call to scatter3(). You need to fill in the blank with whatever arguments you want to use for the outGammut points.
[X,Y,Z]=deal(Lab(1,:), Lab(2,:),Lab(3,:));
in=(DE76(:)<1); out=~in;
inGammut={X(in), Y(in), Z(in)};
outGammut={X(out), Y(out), Z(out)};
hold on
scatter3(inGammut{:},80,RGB,'filled');
scatter3(outGammut{:},_____);
hold off
Thank you, Matt, for your new reply :-)
Please allow me to follow at my own pace (I'm not a rocket scientist...)
I found the "deal" function in Matlab's Help but I'm not sure what it does. I guess you are taking my initial Lab values as input and transforming them in some way? Many Matlab's functions are not for the faint of heart...
When you issue in=(DeltaE(:)<1), I don't follow? Doesn't DeltaE need two arguments? I confess I'm not familiar with the super compact notation but your statement doesn't seem to have any arguments at all?
By the way...
I tried running your code in a new script.
I wasn't expecting the deal function would break down the Lab [3 x n] variable (row1=L, row2=a, row3=b) into separate row vectors -- neat!
But the compiler complains that it does not recognize the 'deltaE' function :
Unrecognized function or variable 'deltaE'.
I suspect it needs a second argument, somehow...
Where I had DeltaE, I really meant DE76.

Sign in to comment.

Categories

Products

Release

R2021b

Asked:

on 22 Dec 2021

Commented:

on 23 Dec 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!