1
$\begingroup$

I am unhappy with the following mapping:

ParametricPlot[{Re@Sin[u + I v], Im@Sin[u + I v]},
 {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2},
 ColorFunction -> (ColorData["DarkRainbow"][#3] &),
 ImagePadding -> 20,
 ImageSize -> 400,
 PlotPoints -> 30]

enter image description here

because of the distinct coloring of its left and right part. I found a certain fix with this:

ParametricPlot[{Re@Sin[u + I v], Im@Sin[u + I v]},
 {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2},
 ColorFunction -> (Blend[{Red, Green, Yellow, Blue, LightBlue, Blue, 
      Yellow, Green, Red}, #3] &),
 ImagePadding -> 20,
 ImageSize -> 400,
 PlotPoints -> 30]

enter image description here

But I really would prefer to use one of the inbuilt gradients to color my figure according to its polygon size or "mesh density".

Thanks in advance for your suggestions.

$\endgroup$
  • $\begingroup$ Something like (Hue[#3] &)? $\endgroup$ – rm -rf Jul 11 '14 at 16:04
  • 1
    $\begingroup$ ColorFunction -> (ColorData["DarkRainbow"][Abs[2 #3 - 1]] &) $\endgroup$ – Rahul Jul 11 '14 at 22:12
  • $\begingroup$ Mr. Coward: I don't particularly care, but could you give a reason for downvoting my question? $\endgroup$ – eldo Jul 11 '14 at 22:22
  • $\begingroup$ If you don't care then why call them a coward and ask for a reason? $\endgroup$ – Rahul Jul 11 '14 at 22:26
  • $\begingroup$ @RahulNarain - Maybe I'm naive - but what is "witch-hunting for downvoters" ? I spent an hour to find a solution myself (to no avail), and received excellent answers so far. $\endgroup$ – eldo Jul 11 '14 at 22:47
2
$\begingroup$

You could do

ParametricPlot[
  {Re@Sin[u + I v], Im@Sin[u + I v]},
  {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2}, 
  ColorFunction -> (ColorData["DarkRainbow"][If[#3 < .5, 1 - #3, #3]] &), 
  ImagePadding -> 20, 
  ImageSize -> 400, PlotPoints -> 30]

enter image description here

$\endgroup$
  • $\begingroup$ "small fishes" - but somehow I wasn't able to catch them :) $\endgroup$ – eldo Jul 11 '14 at 23:00
3
$\begingroup$
ParametricPlot[
 {Re@Sin[u + I v], Im@Sin[u + I v]},
 {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2},
 ColorFunction -> (ColorData["TemperatureMap"][Abs[2 #3/Pi]] &),
 ColorFunctionScaling -> False,
 ImagePadding -> 20,
 ImageSize -> 400,
 PlotPoints -> 30,
 Mesh -> Automatic]

enter image description here

ParametricPlot[
 {Re@Sin[u + I v], Im@Sin[u + I v]},
 {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2},
 ColorFunction -> (ColorData["TemperatureMap"][1 - Abs[2 #4/Pi]] &),
 ColorFunctionScaling -> False,
 ImagePadding -> 20,
 ImageSize -> 400,
 PlotPoints -> 30,
 Mesh -> Automatic]

enter image description here

ParametricPlot[
 {Re@Sin[u + I v], Im@Sin[u + I v]},
 {u, -Pi/2, Pi/2}, {v, -Pi/2, Pi/2},
 ColorFunction -> (ColorData["TemperatureMap"][
     1 - ((1 - Abs[2 #3/Pi])^2 + Abs[2 #4/Pi]^2)] &),
 ColorFunctionScaling -> False,
 ImagePadding -> 20,
 ImageSize -> 400,
 PlotPoints -> 30,
 Mesh -> Automatic]

enter image description 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.