Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
Something like (Hue[#3] &)? –  rm -rf Jul 11 at 16:04
1  
ColorFunction -> (ColorData["DarkRainbow"][Abs[2 #3 - 1]] &) –  Rahul Narain Jul 11 at 22:12
    
Mr. Coward: I don't particularly care, but could you give a reason for downvoting my question? –  eldo Jul 11 at 22:22
    
If you don't care then why call them a coward and ask for a reason? –  Rahul Narain Jul 11 at 22:26
    
@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. –  eldo Jul 11 at 22:47

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer
    
"small fishes" - but somehow I wasn't able to catch them :) –  eldo Jul 11 at 23:00
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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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