I have a plot that uses the slice command.
Is there a way to rescale the colormap of the resulting slice as would usully be done throiugh caxis([lower upper])?

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 12월 30일
편집: Ameer Hamza 2020년 12월 30일

0 개 추천

caxis() also works for slice(). See the difference between two figures
[X,Y,Z] = meshgrid(-2:.2:2);
V = X.*exp(-X.^2-Y.^2-Z.^2);
xslice = [-1.2,0.8,2];
yslice = [];
zslice = 0;
figure()
slice(X,Y,Z,V,xslice,yslice,zslice)
figure()
slice(X,Y,Z,V,xslice,yslice,zslice)
caxis([-2 2])

댓글 수: 2

Nick K
Nick K 2020년 12월 30일
Ahh great, thank you, you confirmed my suspicion!
I was encounering an error message when trying to do this, hence my question. My plot is a combination of several isosurfaces and a background slice. I think the error was due to Matlab believing I was enforcing the colorbar onto the iso-surface part of my plot, as opposed to the slice. By simply plotting the slice first, it was fixed.
Thank you, sir!
Ameer Hamza
Ameer Hamza 2020년 12월 31일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Color and Styling에 대해 자세히 알아보기

제품

질문:

2020년 12월 30일

댓글:

2020년 12월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by