How can I draw separating lines between colors in a 3D volume plot?
Show older comments
I am visualizing a 3D scalar function using the patch command and a given colormap (hsv) associated with the scalar values of the function. Unfortunately, Matlab dow not separate colors with lines, a feature which can be very useful to distinguish close values with similar colors. How can I draw lines between colors in my 3D patch plot? Many thanks for your help,
Luca
6 Comments
KSSV
on 11 Jun 2019
A pictorial example will help us to help you.
luca pavarino
on 11 Jun 2019
G A
on 11 Jun 2019
Try to use options like this: 'EdgeColor','red','LineWidth,2
luca pavarino
on 11 Jun 2019
darova
on 12 Jun 2019
Can you please attach your data?
luca pavarino
on 13 Jun 2019
Answers (1)
KSSV
on 13 Jun 2019
Remove the shading interp line after plotting.
LV_S3_LAT; %load the data
V = Vertices(:,2:4);
T = Triangles(:,2:4)+1;
sV = size(V,1);
sT = size(T,1);
LAT = Values(:,4);
LAT_LV = LAT - min(LAT);
hh=patch('Faces',T,'Vertices',V,'FaceVertexCData',LAT_LV,'FaceColor','interp','EdgeColor','interp','EdgeColor','k');
colormap(hsv);
colorbar;
grid on
view(115,-16);
set(gca,'Color','k');
% shading interp
lightangle(-15,0)
hh.FaceLighting = 'gouraud';
hh.AmbientStrength = 0.3;
hh.DiffuseStrength = 0.8;
hh.SpecularStrength = 0.9;
hh.SpecularExponent = 25;
hh.BackFaceLighting = 'unlit';

3 Comments
darova
on 13 Jun 2019
"I need to put a line only at the boundary of each color (for example between light and dark green), not at the triangulation edges. Thanks,"
Luca
How can we find groups of colored triangles?
KSSV
on 13 Jun 2019
That case, you need to plot the contours on the data. Use this file exchange:
luca pavarino
on 13 Jun 2019
Categories
Find more on Lighting, Transparency, and Shading 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!