5 views (last 30 days)
Show older comments
Roger Breton on 22 Dec 2021
Commented: Matt J on 23 Dec 2021
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?
0 Comments Show -2 older commentsHide -2 older comments
Show -2 older commentsHide -2 older comments
Sign in to comment.
Sign in to answer this question.
Answers (1)
Matt J on 22 Dec 2021
⋮
Edited: Matt J on 23 Dec 2021
Open in MATLAB Online
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 Show 3 older commentsHide 3 older comments
Show 3 older commentsHide 3 older comments
Roger Breton on 23 Dec 2021
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1616275-scatter3-plotting-points-with-different-colors-attributes#comment_1900875
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...
Matt J on 23 Dec 2021
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1616275-scatter3-plotting-points-with-different-colors-attributes#comment_1900955
⋮
Edited: Matt J on 23 Dec 2021
Open in MATLAB Online
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
Roger Breton on 23 Dec 2021
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1616275-scatter3-plotting-points-with-different-colors-attributes#comment_1901680
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?
Roger Breton on 23 Dec 2021
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1616275-scatter3-plotting-points-with-different-colors-attributes#comment_1901755
Open in MATLAB Online
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...
Matt J on 23 Dec 2021
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1616275-scatter3-plotting-points-with-different-colors-attributes#comment_1901760
Where I had DeltaE, I really meant DE76.
Sign in to comment.
Sign in to answer this question.
See Also
Categories
MATLABLanguage FundamentalsLoops and Conditional Statements
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office