8

I want to plot several 2D curves (Sin[x] at y=0, Cos[x] at y=1) in a 3D plot, what function should i use?

f[x_, y_] := Piecewise[{{0, y < 0 || y > 0}, {Sin[x], y == 0}}]
g[x_, y_] := Piecewise[{{0, y < 1 || y > 1}, {Cos[x], y == 1}}]
Plot3D[{f[x, y], g[x, y]}, {x, 0, 10}, {y, 0, 10}]

doesn't work. Any ideas?

user13253
  • 8,666
  • 2
  • 42
  • 65

1 Answers1

19
ParametricPlot3D[{{Sin[u], 0, u}, {Cos[u], 1, u}}, {u, 0, 20}, 
 BoxRatios -> 1, PlotRange -> {{-2, 2}, {-.5, 2}, {0, 20}}]

enter image description here

=== update - general thoughts ===

I've seen the comments to this question and a few other approaches to the waterfall (or wire) plot are given in this question: Plotting several functions. Also I cannot not mention one of my favorite Mathematica blogs - Archery with this post on the story of discovery of 1st pulsar and an its infamous graphics - code is given in the post:

enter image description here

Vitaliy Kaurov
  • 73,078
  • 9
  • 204
  • 355