[R] Re: persp() varying colors with "z" values.

Martin Maechler maechler at stat.math.ethz.ch
Thu Feb 6 09:47:02 CET 2003

>>>>> "Gregory" == Gregory BENMENZER <gregory.benmenzer at gazdefrance.com>
>>>>>     on Thu, 6 Feb 2003 09:17:41 +0100 writes:

    Gregory> hello,

    Gregory> you can use the persp() function. The shade=0.7
    Gregory> option is very nice. With matlab, it is possible to
    Gregory> change of colors automaticalli with the value to be
    Gregory> plotted.

    Gregory> Does someone know to do that ?

Yes.  Look at the last plot of the persp() demo,
> demo(persp)

As you can see there you need two steps:
 1) define a color vector, say `zCol' varying with your z variate
 2) persp(x,y,z, col = zCol, ....)

I hope this helps.

    >> f0z6305 at labs.tamu.edu@stat.math.ethz.ch on 06/02/2003 07:05:04
    >> Pour : r-help at stat.math.ethz.ch
    >> Objet :     [R] About STEM Plot in R

    Fred> Hey

    Fred> Does anybody know if R can plot the 3-dimensinal
    Fred> stem graphs?

    Fred> In Matlab, there is such similare function to plot
    Fred> 3D plots, stem3(X,Y, Z), where X, Y , Z (column vectors) are
    Fred> coordinate values of data points.

    Fred> Thanks.
    Fred> Fred

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

More information about the R-help mailing list