3
$\begingroup$
Graphics3D[
 MapIndexed[
  Cases[#, Line[L_] :> {Red, 
      Line[Thread[{L[[All, 1]], #2[[1]]/5, L[[All, 2]]}]]}, -1] &, 
  Table[Plot[Sin[x]^n, {x, 0, \[Pi]}], {n, 5}]], Axes -> True, 
 BoxRatios -> {1, 1, 1}]

The above code generates an image shared below

enter image description here

However, I want each curve to be in a different colour, as in this (2D) PlotStyle -> ColorData[110, "ColorList"]

enter image description here

How do I do this in 3d? Please help me modify my above code to get the desired result in 3D

$\endgroup$

2 Answers 2

5
$\begingroup$
nc = 100;
nr = 5;
coords = Table[{x, n/nr, Sin[x]^n}, {n, nr}, {x, 0, π, π/nc}];

ListLinePlot3D[coords, PlotStyle -> 110, BoxRatios -> 1]

enter image description here

$\endgroup$
3
$\begingroup$
f[n_Integer, x_] := Sin[x]^n;
Graphics3D[
 MapIndexed[
  Cases[#, Line[L_] :> {Thick,ColorData[110][First[#2]], 
      Line[Thread[{L[[All, 1]], First[#2], L[[All, 2]]}]]}, -1] &, 
  Table[Plot[f[n, x], {x, 0, Pi}], {n, 5}]], Axes -> True, 
 BoxRatios -> {1, 1, 1}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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