Hello,
I have a 3D surface, displayed with surf function. All the colormaps are a function of Z value, meaning that in XY plane the color does not change. I need to color the surface as a function of the distance from the origin, meaning the color on the same radius does not change, no matter what the direction from the origin: x, y or z. Any ideas how to do this?
Thanks!

답변 (2개)

Image Analyst
Image Analyst 2016년 9월 4일

0 개 추천

Not sure that's possible. You could do it if you made it an actual color image instead of a 2.5-D rendering of the image as a surface but you'd just have a 2-D color image, not s surface looking rendering.

댓글 수: 2

E
E 2016년 9월 5일
Thanks,
That would be strange, because matlab connects somehow the values of Z to the color, if I knew how, I could change the color any way I want... It may be complicated, but I believe it is possible
Thank though for the try!
Image Analyst
Image Analyst 2016년 9월 5일
It does, but you didn't want that. You wanted (I think) to ignore z and color the grid as a function of sqrt(x^2+y^2) which is the distance of the point from the origin. You can make up a new Z which is sqrt(x^2+y^2) but then it won't look anything like your original z.

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

Luke Albers
Luke Albers 2022년 12월 29일

0 개 추천

Simply define a colormap variable equal to the radius C=(sqrt(x.^2+y.^2+z.^2) and include it in the plot command: surf(x,y,z,C)

카테고리

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

질문:

E
E
2016년 9월 4일

답변:

2022년 12월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by