Switch colormap targeted axis

조회 수: 3 (최근 30일)
Nicolas Douillet
Nicolas Douillet 2020년 2월 4일
답변: Nicolas Douillet 2020년 2월 4일
Hi,
It is super easy to switch the axis while using a "surf / mesh like function" (simply by switching the X,Y,Z order in surf(X,Y,Z) )
However, when adding a colormap I didn't find anywhere how to also switch the colormap targeted axis. Meaning if I write surf(Z,Y,X), the colormap will target the third element, which is X here, not Z axis, the one I would like for the same rendering.
Do you have any idea of how I could do this ?
Thank you
Nicolas
Edit : for example with this code :
[X,Y,Z] = peaks(64);
surf(Z,X,Y);
I would like of course the colormap to be in the depth direction.
  댓글 수: 1
Adam
Adam 2020년 2월 4일
Use the 4th argument to surf and pass in whichever variable you wish to use again, e.g.
surf( Z, X, Y, Z )

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

채택된 답변

Nicolas Douillet
Nicolas Douillet 2020년 2월 4일
So simple, so clever !
Great thank Adam, I was struggling with much more complex tries.

추가 답변 (0개)

카테고리

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