Filter löschen
Filter löschen

Change Direction of Colors of surface in Property Inspector of Figure

6 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 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!)

Weitere Antworten (0)

Kategorien

Mehr zu Visual Exploration finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by