Clear Filters
Clear Filters

Combine scatter3 and trisurf plots?

15 views (last 30 days)
Roger Breton
Roger Breton on 18 Dec 2021
Answered: Voss on 18 Dec 2021
The next step in my project is to combine the display of two separate "charts" or 'plots' onto a single one.
First, I have a "3D scatter of a series of colored points" like this :
Then, I have, using the same axis, this plot, which represent the "outer surface" of the sRGB 3D 'gamut' (I only made a partial number of points for testing) :
This second "figure", would be more meaningful if it was being displayed, here, in 3D but I my screen capture software can only grab a 2D image).
I have not (yet) found how to combine these two plots onto the same one? I think I have to use sub-plots?
I confess I'm not familiar with all the different plot types that Matlab support but I tend to think that I could use a trisurf plot :
You see, my goal is to show my students that the colors they see in, say, Photoshop, are all "contained" in a 3D space. That's why I think a trisurf figure being displayed on top of the 3D points scatter would be beneficial for understanding what is the relationship of the two elements, the image being displayed (the subject, its characteristic colors) and the capability of some device, represented here by my humble Lab characterization, for which I have Lab arrays for.
This, by the way, is an interesting plot :
The code to run this is :
[r,g,b] = meshgrid(linspace(0,1,50));
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb);
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
trisurf(k,a,b,L,'FaceColor','interp','FaceVertexCData',rgb,'EdgeColor','none')
I would love to experiment with my Lab values which are in this form :
at the place of the (linspace(0,1,50)); above? Can I feed in my mesVarT array to the meshgrid function? I'll give it a try...
Sorry for the overly lengthy post. Color is soooo interesting :-)

Accepted Answer

Voss
Voss on 18 Dec 2021
subplot will give you a grid of axes. It sounds more like you want one axes with multiple graphics objects in it, in which case you can use hold on. Call hold on after the first plotting command (e.g., scatter3, trisurf, etc.), and the subsequent plotting commands will not replace the previous ones. For instance:
scatter3(x,y,z);
hold on
trisurf(tri,X,Y,Z);
This will produce a scatter3 plot and a trisurf plot in the current axes together.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!