Change Direction of Colors of surface in Property Inspector of Figure

5 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 19 Sep 2018
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!)

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!