필터 지우기
필터 지우기

Change Direction of Colors of surface in Property Inspector of Figure

조회 수: 6 (최근 30일)
Hello
Is there a way to change the direction of the colors of a 3D surface with the Property Inspector of a Figure? At the moment colors change with the z-axis and I want the color to change with y-axis. I am aware how to do it by code ( https://de.mathworks.com/help/matlab/creating_plots/how-surface-plot-data-relates-to-a-colormap.html), but is there a possibility to do it in the Figure-File in the Property Inspector?
THX in advance
MJ

채택된 답변

Walter Roberson
Walter Roberson 2018년 9월 19일
No, there is not.
Changing the color of a surface can potentially happen in a small number of different ways:
  1. the color is texture-mapped, and you change the CData property to reflect the new colors -- essentially overlay a different image than before. For CData of any non-trivial size, this is impractical to do in the property inspector as the property inspector does not permit you to nominate variables or function calls whose value is to be used to replace the current value
  2. colors are associated with the vertices, and you use the property inspector to change the properties that control the interpolation method, such as configuring flat (color is value associated with the first vertex in the face) or interpolation. These properties do not have the flexibility to say "pick the vertex that is closest to the y axis and use that as the base color"
  3. colors are associated with the vertices and you use the property inspector to change the associated value, which is the CData property. For CData of any non-trivial size, this is impractical to do in the property inspector as the property inspector does not permit you to nominate variables or function calls whose value is to be used to replace the current value
That is, there is nothing associated with the "primitive surface object" that actually specifies that the color is to determined by the Z coordinate: what really happens when you surface() with that configuration is that it is the Z coordinate that is written into the CData property.
Using code, you can easily request to instead use the Y coordinates (by passing them in the color slot) or you can change the CData property of the object after it is created, writing in the Y coordinates. But the property inspector is not a practical place to edit the CData values (unless your surface has very few points!)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by