When I ejecute:
Z = [5 10 10 5
5 10 10 5];
surf(Z)
I get a figure which has three faces, and It colors first face with blue and second and third with yellow. I would like to modify this painting with yellow in last face. My objective is to get figure has colors according to values in Z, that is,
  • 5 to 10 -> blue,
  • 10 to 10 -> yellow, and
  • 10 to 5 -> blue.

 Réponse acceptée

Akira Agata
Akira Agata le 19 Jan 2018
You can control surface color by setting color value, like the following. More details can be found in help page of surf function.
C = zeros([size(Z),3]);
C(1,1,:) = [0 0 1]; % blue
C(1,2,:) = [1 1 0]; % yellow
C(1,3,:) = [0 0 1]; % blue
surf(Z,C)

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by