colormap for a matrix with 4 columns
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I have a 3D plot with around 200 points and each has an associated vector (C1,C2,C3,C4) so matrix C = 200x4. I am looking to get a colormap to assign a unique color to each point in a plot based on their four Ci values (i.e. to get a color as mix of 4 colors such as CMYK). Any help would be appreciated
Thanks in advance
0 Commenti
Risposte (2)
Walter Roberson
il 27 Ott 2018
The *.icc file can be obtained at the link above.
I_cmyk = reshape(mat2gray(C),size(C,1), 1, 4);
inprof = iccread('USSheetfedCoated.icc');
outprof = iccread('sRGB.icm');
C = makecform('icc',inprof,outprof);
I_rgb = applycform(I_cmyk,C);
rgbmap = reshape(I_rgb, [], 3);
pointsize = 20; %adjust as desired
scatter3( X(:), Y(:), Z(:), pointsize, rgbmap );
5 Commenti
Image Analyst
il 27 Ott 2018
I think the way I gave in my answer should work. Basically you have to normalize your C measurements, then take the mean of them all.
Walter Roberson
il 27 Ott 2018
According to references I find, "dark cyan" is CMYK 100, 0, 0, 45. This is distinctly different than CMYK 100, 0, 0, 0, so if you want C1 to correspond to dark cyan then it is not possible to calculate it based upon relative portions 1.0, 0.0, 0.0, 0.0 in any permutation.
Using data cursor to read off the colors at the vertices of your diagram as best I can, and using the conversion at https://www.rapidtables.com/convert/color/rgb-to-cmyk.html (and note that max for RGB is 255 but max for CMYK is 100)
C1 - RGB [41 38 39] CMYK - [0 7 5 84]
C2 - RGB [246 233 74] CMYK - [0 5 70 4]
C3 - RGB [0 180 236] CMYK - [100 24 0 7]
C4 - RGB [234 15 137] CMYK - [0 94 41 8]
The only one of those that maps at all well to CMYK is C3, potentially pure cyan, but C3 has 1/4 magenta in the mix.
The CMYK that I get out of the conversion from the Mathworks Support link appear to be rather different than the values from the online calculator. It is possible that the conversion profile is quite different, but the differences are fairly large, so I am not convinced the conversion is accurate for the one provided by Mathworks Support.
Anyhow, your tetrahedron does not match CMYK.
I do not think that humans could be expected to mentally interpolate between four different values (C1, C2, C3, C4) based upon three pieces of information (R, G, B). Humans are not all that good at identifying mid colors, especially not in small swathes.
Image Analyst
il 27 Ott 2018
Can you attach C in a .mat file, and include a screenshow of your 3-D plot?
What are the 3 axes in the 3-D plot? C1, C2, and C3? What to the 4 C's represent? X, Y, Z, and something? What exactly is a "point"? A plot in 4-D space, or a point in 3D space where C4 is some kind of intensity value at the x,y,z coordinate? If you have 200 points and want a colormap with 200 unique colors, why can't you just do
cmap = hsv(200); % Make 200 unique colors.
4 Commenti
Walter Roberson
il 27 Ott 2018
? plot3 does not take a 4th numeric input, and does not permit an array of color inputs ?
Image Analyst
il 27 Ott 2018
I guess you'd have to use scatter3() then, which can take a color for every point.
Vedere anche
Categorie
Scopri di più su Orange in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

