"Steven_Lord" <slord@mathworks.com> wrote in message <imo45p$m7$1@fred.mathworks.com>...
>
>
> "Hermano Cappa" <cappasteven@gmail.com> wrote in message
> news:imluo0$r7q$1@fred.mathworks.com...
> > Hi,
> >
> > I have a 3Dplot of a sphere made with the surfcommand. By default the
> > color changes with the height of the data (zdirection > color variation
> > with the height of the sphere). How can I change the direction of this
> > variation in color in such a way that when the data which is the furthest
> > away form the origin (xydirection), thus at the equator, has a red color
> > and the data which lies on xyaxis has a blue color? Thus a variation in
> > color that changes with the distance till an axis through the origin.
>
> http://www.mathworks.com/help/techdoc/ref/surf.html
>
> "surf(X,Y,Z) creates a shaded surface using Z for the color data as well as
> surface height." and
>
> "surf(X,Y,Z,C) creates a shaded surface, with color defined by C."
>
> [x,y,z] = peaks;
> subplot(2, 1, 1);
> surf(x, y, z, z); % color varies by z
> subplot(2, 1, 2);
> surf(x, y, z, x); % color varies by x
>
> 
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
Thank you very much Steve it works great! I thought it must be done with Clim but it is rather badly explained when you type 'help surf' in Matlab.
