0
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Bottom plot is not rainbow see this mathematica.stackexchange.com/questions/101268/… $\endgroup$ – OkkesDulgerci Apr 8 '18 at 15:22
  • 2
    $\begingroup$ 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] $\endgroup$ – J. M. will be back soon Apr 8 '18 at 16:00
  • 1
    $\begingroup$ Just add ColorFunctionScaling -> False to your original plot. $\endgroup$ – Rahul Apr 8 '18 at 16:19
  • 2
    $\begingroup$ @J.M. - recommend that you also increase the PlotPoints $\endgroup$ – Bob Hanlon Apr 8 '18 at 16:20
  • $\begingroup$ 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) $\endgroup$ – Paul Saturday Apr 8 '18 at 17:13
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.