3D colorplot as a function of radius
显示 更早的评论
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
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
2016-9-5
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
2022-12-29
0 个投票
Have a look at this link: https://www.mathworks.com/help/matlab/creating_plots/how-surface-plot-data-relates-to-a-colormap.html
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!