8

I'd like to draw

Plot[Re@Sin[x+I*2], {x, -10, 10}]

as an epilog on

Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}]

and position it at y=2.

What's intuitive to me doesn't work:

epilogData = Table[{x, 2, Re@Sin[x + 2*I]}, {x, -10, 10, 0.1}];

Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}, 
 Epilog -> {Red, PointSize[Large], Point[epilogData]}]

Using

epilogData2D = Table[{x, Re@Sin[x + 2*I]}, {x, -10, 10, 0.1}];

will draws something, but not what i want (What's that anyway?).

I've also played with Inset and got no luck so far.

user13253
  • 8,666
  • 2
  • 42
  • 65

3 Answers3

10

Maybe it helps to use Mesh:

Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}, 
  Mesh -> {{{0, None}}, {{2, {Red, Thick}}}}]

Plot3D with mesh

With a varying y:

frames = Table[
  Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}, 
  Mesh -> {{{0, None}}, {{i, {Red, Thick}}}}], {i, -10, 10, .5}];
Export["animation.gif", frames]

enter image description here

VLC
  • 9,818
  • 1
  • 31
  • 60
3

Like this?

With[{y0 = 2}, 
     Show[Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}], 
          Graphics3D[{AbsoluteThickness[4], 
                      First[Plot[Re@Sin[x + I y0], {x, -10, 10}]] /.
                      v : {__?NumericQ} :> Insert[v, y0, 2]}]]]

surface with marked line

The use of Mesh, as in VLC's answer, is much easier, tho.

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

Mesh as in VLC's answer is my favorite approach. Nevertheless, you can also use Exclusions and ExclusionsStyle:

Plot3D[Re@Sin[x + I*y], {x, -10, 10}, {y, -10, 10}, Mesh -> None, 
 Exclusions -> {Automatic, y == 2}, 
 ExclusionsStyle -> Directive[Opacity[1], Red, Thick]]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896