0

probably a trivial questions, but I couldn't find a solution for over 2 hours:

I want to produce a RevolutionPlot3D of a function, f1, with a separate colorfunction, f2. I thought it might be possible to specify something like:

RevolutionPlot3D[r^2*Sin[2*\[Theta]], {r, 0, 1}, {\[Theta], 0, 2*Pi}, 
 ColorFunction -> Function[{x, y, z, r1, \[Theta]1}, ColorData["Rainbow"][Abs[z]]]]

where

f1 = r^2*Sin[2*\[Theta]] 

and

f2 = Abs[r^2*Sin[2*\[Theta]]] 

but I got this enter image description here

instead of the expected outcome that should look like this: enter image description here

Thank you very much for your help.

Paul Saturday
  • 415
  • 3
  • 9
  • 2
    Bottom plot is not rainbow see this https://mathematica.stackexchange.com/questions/101268/how-to-customize-color-scheme-to-mimic-that-in-origin – OkkesDulgerci Apr 08 '18 at 15:22
  • 2
    Based on @Okkes's comment: RevolutionPlot3D[r^2 Sin[2 θ], {r, 0, 1}, {θ, 0, 2 π}, ColorFunction -> Function[{x, y, z, r, θ}, Hue[2 (1 - Abs[r^2 Sin[2 θ]])/3]], ColorFunctionScaling -> False, Mesh -> False] – J. M.'s missing motivation Apr 08 '18 at 16:00
  • 1
    Just add ColorFunctionScaling -> False to your original plot. –  Apr 08 '18 at 16:19
  • 2
    @J.M. - recommend that you also increase the PlotPoints – Bob Hanlon Apr 08 '18 at 16:20
  • Thanks a lot, Rahul! It finally clicked and I understand the comment now. Thanks J.M. & Dulgerci - I wouldn't have spotted it. Problem solved (in case you want to post it as an answer) – Paul Saturday Apr 08 '18 at 17:13

1 Answers1

1

To settle this:

RevolutionPlot3D[r^2 Sin[2 θ], {r, 0, 1}, {θ, 0, 2 π}, 
                 ColorFunction -> Function[{x, y, z, r, θ}, 
                                           Hue[2 (1 - Abs[r^2 Sin[2 θ]])/3]], 
                 ColorFunctionScaling -> False, Mesh -> False, PlotPoints -> 75]

colored saddle

where I used the color scheme featured here.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574