Hi this may seem to be a simple question but I am having a hard time understanding how to use the colors in a plot3d.
That is what I have:
// x, y and z are matrix 4 by 100
myColors = ones(1,size(z,2));
plot3d(x,y,list(z,myColors),alpha=0,theta=270);
I would like to have myColors related to the altitude of z.
If I understand correct x, y and z are something like:
x = [ 1:100 ];
y = [ 1:4 ];
z = rand( length(x), length(y) ); //Some function resulting in (100 x 4) matrix
Then you can plot it using the following code.
plot3d( x, y, z, alpha=0, theta=270);
e = gce(); // Get current entity handle.
e.color_flag = 1; // Color according to z
f = gcf(); // Get current figure handle.
f.color_map = hotcolormap(512); // Make it a heat color map
According to the plot3d docs and surface_properties docs the color_flag
can be used to:
color_flag: This field is used to specify the algorithm used to set facets' colors.
Note that the rules on color_mode, foreground and hiddencolor are still applied to this case.
...
color_flag == 1
All facets are painted using one color index per facet proportional to z. The minimum z value is painted using the index 1 color while the maximum z value is painted using highest color index. The edges of the facets can be additionaly drawn depending on the value of color_mode (see above).