MATLAB Answers

set the contourslice line colors

조회 수: 9(최근 30일)
Hossein Khanjari
Hossein Khanjari 2021년 2월 7일
댓글: Hossein Khanjari 2021년 2월 11일
Hi,
I am plotting contourslices however I want to set the contour lines all to black but the plots return colorbar. I tried:
h2 = contourslice(ZI2,YI2,XI2,UI2,[],[],[xloc],[-0.075:0.075/5:0.075]);
set(h2,'linewidth',1.5,'linecolor','k');
set(h2,'linecolor',[0 0 0]);
but it seems that there is not any linecolor defined for the contourslices. I would be thankful if you help me.
Thanks in advance

채택된 답변

Srivardhan Gadila
Srivardhan Gadila 2021년 2월 10일
The following syntax of s = contourslice(___) of the contourslice function returns the array of Patch objects created. You can refer to the documentation of Patch Properties and access/modify them accordingly.
Change the EdgeColor of the Patch Objects as follows:
[X,Y,Z] = meshgrid(-2:.2:2);
V = X.*exp(-X.^2-Y.^2-Z.^2);
xslice = [-1.2,0.8,2];
yslice = [];
zslice = [];
s = contourslice(X,Y,Z,V,xslice,yslice,zslice);
view(3)
grid on
set(s,'EdgeColor','k')
  댓글 수: 1
Hossein Khanjari
Hossein Khanjari 2021년 2월 11일
Thanksa lot!
It worked

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by