-2

I can display a 3D surface with z-axis {z,-100, 15000}: Plot3D[n2U[v, n], {v, -100.0, 20.0}, {n, 0.0, 1.0}].

I can plot a 3D line: ListLinePlot3D[mydata] which has z-axis {z, -100, 12000}. The line happens to lie on the 3D surface but that is not relevant to the question:

How can I display the 3D surface and the 3D line in the same 3D cartesian coordinate system?

Peter R
  • 61
  • 3
  • 2
    Can you, please, provide some minimal working code for the Plot3D and the ListLinePlot3D? – bmf Jan 09 '23 at 05:12
  • What does *Heading* have to do with anything?? – David G. Stork Jan 09 '23 at 06:57
  • Across the top of the screen you should see "Search on Mathematica..." I typed "draw line on plot" in that box, but did not include those quotes, and found several likely answers in the first ten results. From that I used one of those answers Show[Plot3D[x+y,{x,-1,1},{y,-1,1},PlotStyle-> Green], Graphics3D[{Red,Line[{{-1,-1,-2},{1,1,2}}]}]] Adjust that as needed. – Bill Jan 09 '23 at 07:31
  • Similar to 20565. – Syed Jan 09 '23 at 07:53
  • Thank you, Bill. This "Show"s me how to proceed (pun intended). – Peter R Jan 10 '23 at 05:18

1 Answers1

2

You may use "Show" for this:

line = ListLinePlot3D[Table[{x, 0, x^2}, {x, -1, 1, 0.1}], 
   PlotStyle -> {Red, Thickness[0.01]}];
Show[{line,
  Plot3D[{x^2 + y^2}, {x, -1, 1}, {y, -1, 1}]
  }]

enter image description here

Daniel Huber
  • 51,463
  • 1
  • 23
  • 57