필터 지우기
필터 지우기

How can I draw separating lines between colors in a 3D volume plot?

조회 수: 2 (최근 30일)
luca pavarino
luca pavarino 2019년 6월 11일
댓글: luca pavarino 2019년 6월 13일
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
darova
darova 2019년 6월 12일
Can you please attach your data?
luca pavarino
luca pavarino 2019년 6월 13일
The Matlab code fragment is the following and the data file is attached.
Thanks,
Luca
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');
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';

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2019년 6월 13일
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';
untitled.bmp
  댓글 수: 3
KSSV
KSSV 2019년 6월 13일
That case, you need to plot the contours on the data. Use this file exchange:
luca pavarino
luca pavarino 2019년 6월 13일
These solutions do not work:
a) removing shading interp line after plotting just draw the triangles boundary, which is not what I need (I need to draw the boundary between the colors assigned by the colormap, i.e. I need to draw the isochronal lines or a scala field over a 3D volume).
b) the TRICONTOUR(TRI,X,Y,Z) function is not what I need because it draws countour lines of Z. What I need would be a TRICONTOUR(TRI,X,Y,Z,W) where W is a scalar function defined over the 3D volume described by X, Y, Z, but such a functions does not seem to exist in Matlab.
Luca

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by