Re: Contour line colors from z coord of a 3D plot

• To: mathgroup at smc.vnet.net
• Subject: [mg117191] Re: Contour line colors from z coord of a 3D plot
• From: recmath <recmath99 at gmail.com>
• Date: Thu, 10 Mar 2011 16:05:07 -0500 (EST)

```On Mar 10, 6:43 am, Bob Hanlon <hanl... at cox.net> wrote:
> Module[{f, ch = Purple, cl = Yellow},
>  f[x_, y_] := Log[x + I y];
>  logre = Show[
>    Plot3D[Re[f[x, y]],
>     {x, -2.4, 2.4}, {y, -2, 2},
>     PlotStyle -> Opacity[0.7],
>     PlotRange -> {-3, 1.5},
>     ColorFunction ->
>      (Blend[{cl, ch}, #3] &),
>     MeshStyle -> Darker[Gray]],
>    Graphics3D[
>     ContourPlot[Re[f[x, y]],
>        {x, -2.4, 2.4}, {y, -2, 2},
>        Axes -> False,
>        Contours -> Table[z, {z, -1, 1, .25}],
>        ContourStyle ->
>         Table[
>          Blend[{cl, ch}, (z + 1)/2],
>          {z, -1, 1, .25}]][[1]] /.
>      {x_Real, y_Real} -> {x,
>        y, -3}],
>    ViewPoint -> {2.2, -4, 1.3},
>    ImageSize -> 400]]
>
> Bob Hanlon
>
> ---- recmath <recmat... at gmail.com> wrote:
>
> =============
> Hi there,
>
> I'm trying to reproduce this very cool figure:http://en.wikipedia.org/wik=
i/File:NaturalLogarithmRe.png
>
> Problem: I can't get the contour lines color-matched to the 3D
> surface, which is colored according to it's height. My code is below,
> can anyone help?
>
> Module[{f}, f[x_, y_] := Log[x + I y];
>
>  logre = Show[Plot3D[Re[f[x, y]], {x, -2.4, 2.4}, {y, -2, 2},
>     PlotStyle -> Opacity[0.7], Axes -> True, Boxed -> True,
>     PlotRange -> {Automatic, Automatic, {-3, 4}},
>     ColorFunction -> (Blend[{Yellow, Purple}, #3] &)],
>    Graphics3D[
>     ContourPlot[Re[f[x, y]], {x, -2.4, 2.4}, {y, -2, 2},
>        Axes -> False, ContourShading -> None,
>        ContourStyle -> Purple][[
>       1]] /. {x : _Real, y : _Real} -> {x, y, -3}],
>    ViewPoint -> {2.2, -4, 1.3}, ImageSize -> 300
>    ]
>  ]

This produces a fantastic figure, thank you.

```

• Prev by Date: Re: CDF player and opening non-Mathematica files
• Next by Date: CDF Player vs. Mathematica browser plug-in
• Previous by thread: Re: Contour line colors from z coord of a 3D plot
• Next by thread: Re: Contour line colors from z coord of a 3D plot