From: Daragh on
Hi,

I'm using the function plot3 to display a 3D plot of a set of data points.
Taking the following simple example:

x = 0:0.1:10;
plot3(x.^2,x,x)
grid on
axis square

How would I call plot3 so that the colour of the line is a function of the height.
Ideally I would like a light crey colour for low values which gets darker
as the function value increases.

Thanks!
From: Walter Roberson on
Daragh wrote:

> I'm using the function plot3 to display a 3D plot of a set of data points.
> Taking the following simple example:
> x = 0:0.1:10;
> plot3(x.^2,x,x)
> grid on
> axis square
>
> How would I call plot3 so that the colour of the line is a function of
> the height.

You cannot do that with plot3(). Any one line in line() or plot() or
plot3() must be the same color from beginning to end.

You might be able to use scatter3() for your purposes.
From: Daragh on
Thanks for the feedback,

> You cannot do that with plot3(). Any one line in line() or plot() or
> plot3() must be the same color from beginning to end.
>
> You might be able to use scatter3() for your purposes.

Do you know how would I write the example I gave using scatter3 so that
the colour was proportional to the height?
From: Daragh on

I've managed to write what I need done using the function mesh - where
the colour is proportional to the height. However, I'd like the colours to be
a varying shade of grey - how can I do this using mesh?

Thanks,

Daragh
From: us on
"Daragh " <wawel100(a)gmail.com> wrote in message <i1q1o8$fih$1(a)fred.mathworks.com>...
>
> I've managed to write what I need done using the function mesh - where
> the colour is proportional to the height. However, I'd like the colours to be
> a varying shade of grey - how can I do this using mesh?
>
> Thanks,
>
> Daragh

a hint:

help colormap;
help gray; % <- and siblings - except for gray's anatomy, of course...

us