Re: How To invert ColorFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg106736] Re: [mg106719] How To invert ColorFunction
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 22 Jan 2010 05:38:14 -0500 (EST)
- References: <11800934.1264074096060.JavaMail.root@n11>
The question is: what are the arguments to the ColorFunction? One can usually find this by looking on the ColorFunction Help page where they list (in More Information) the arguments for various plot types. But I can't find RevolutionPlot3D listed there. However, on the RevolutionPlot3D page, Examples, Options, ColorFunction, first example WRI does give the ordering of the parameters. These are: {x, y, z, t, \[Theta], r} I don't know exactly how you want to color the surface. Suppose you want to color according to the z value and use the reverse gradient. Then you could write: c4 = 1; z4[rho_, theta_] := rho^2 Cos[2 theta] RevolutionPlot3D[c4 z4[rho, theta], {rho, 0, 1}, {theta, 0, 2 \[Pi]}, ColorFunction -> (ColorData["Rainbow"][1 - #3] &)] You could also write this as: RevolutionPlot3D[c4 z4[rho, theta], {rho, 0, 1}, {theta, 0, 2 \[Pi]}, ColorFunctionScaling -> False, ColorFunction -> (ColorData["Rainbow"][Rescale[#3, {1, -1}]] &)] Or as: RevolutionPlot3D[c4 z4[rho, theta], {rho, 0, 1}, {theta, 0, 2 \[Pi]}, ColorFunctionScaling -> False, ColorFunction -> (ColorData["Rainbow"][ Rescale[#3, {-1, 1}, {1, 0}]] &)] The usefulness of that construction is if your wanted to write your own color function as a function of the actual parameters. Then you could find the minimum and maximum values over the surface and use Rescale to fit it to a gradient, a reverse gradient or even a part of a gradient. Notice also that in Version 7, if one uses a ColorFunction on various surface plots, Mathematica uses Lighting -> "Neutral". This is nice because the color of the lights won't overwhelm pastel colored surfaces. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Vladimir [mailto:svetlana_47 at yahoo.de] Hi everybody, I am plotting Zernike-Polynomials like this: --------- c4 = 1; z4[rho_, theta_] := rho^2*Cos[2*theta] RevolutionPlot3D[c4*z4[rho, theta], {rho, 0, 1}, {theta, 0, 2*Pi}, ColorFunction -> "Rainbow"] --------- To be able to compare the plot to measured data from an interferometer, I would like to invert the Rainbow colouring, that is red at the bottom and blue on top. However, I can't find to work this out. Does anyone know how to do this? Thank you, Vladimir.