2
$\begingroup$

I'm trying to draw 3D plot from my experimental points in the way shown at the figure below:

enter image description here

I tried to use ListPointPlot3D for that, but obviously there is no option Joined as in ListPlot.

mydata = Table[{x, y, x*y*y}, {x, 0, 1, 0.03}, {y, 0, 10, 1}];
ListPointPlot3D[mydata, Filling -> Bottom, 
 ColorFunction -> Function[{x, y, z}, RGBColor[y, 0., 0.3]]]

So I obtained this:

enter image description here

Any idea how I can join the point to obtain the set of flat curves with filling?

$\endgroup$
0

2 Answers 2

2
$\begingroup$

I don't see an easy way to do this with ListPointPlot3D or by layering a bunch of 2D ListPlots in a 3D box. However, it's fairly straightforward to do this manually, with basic graphics primitives. The shape of each curve is simply a polygon that traverses all the points in each row, but also includes one point at at z = 0 below the first and last point in the list. You'll just have to take care of colouring yourself:

color[n_] := With[{palette = ColorData[97, "ColorList"]},
  palette[[Mod[n, Length@palette, 1]]]
]
Graphics3D[
  MapIndexed[
    {
      [email protected],
      color@#2[[1]],
      Polygon[Join[#, {Last@#*{1, 1, 0}, First@#*{1, 1, 0}}]]
    } &,
    mydata
  ],
  BoxRatios -> {1, 1, 1/2},
  Axes -> True,
  Lighting -> "Neutral"
]

enter image description here

Note that this fills in the y-z planes. If you want to fill in the x-z planes instead, simply use Transpose @ mydata inside the MapIndexed instead:

enter image description here

$\endgroup$
1
$\begingroup$

This task can be accomplished by using ListLinePlot3D (starting v12.3/2020). As an example.

mydata = Table[{x, y, x*y*y}, {x, 0, 1, 0.2}, {y, 0, 10, 1}];

ListLinePlot3D[mydata, Filling -> Bottom, 
 ColorFunction -> Function[{x, y, z}, RGBColor[y, 0., 0.3]]]

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.