How to make a 3D listplot with meshlines going only along one cartesian coordinate?

I have an external python code that computes a bunch of data, which I read into Mathematica as a table, so: Import["Documents\Hubbard\Python\data.dat", "Table"];

These files are quite large so I couldn't show them in their entirety here, but they look something like {{x0,y0,z0},{x1,y1,z1},...} and so on for let's say N coordinate triplets.

Now, ListPlot3D or ListPointPlot3D work fine for plotting this data, but my isse is that I do not want a surface, not even with the default mesh lines in the x- and y-directions.

How do I plot this data with only having mesh lines going along one of the coordinates? Look in the image below for what I would like to have. I tried Mesh command but it doesn't seem to work well with the above Plot commands - and honestly the Help pages sound a bit like gibberish to me.

Any ideas?

Edit: Forgot to add the closest "guess" I have for a command line:

ListPointPlot3D[SC, MeshFunctions -> {#1 &, None}]

Where I'm using ListPointPlot to avoid the automatic surface that ListPlot creates, however the command creates an error :-(

Using example data from DanielHuber's answer:

SeedRandom[1]
d = Table[{x, y, RandomReal[3 {-1, 1}]}, {x, 5}, {y, 20}];


1. ListPlot3D + MeshFunctions

lp3d = ListPlot3D[Join @@ d, PlotStyle -> None,
MeshFunctions -> {# &},
Mesh -> {{#, ColorData[97]@#} & /@ Range[5]},
MeshStyle -> Thick,
BoundaryStyle -> None]


Use MeshFunctions -> {#2 &} and Mesh -> {{#, ColorData[97]@#} & /@ Range[20]} to get mesh lines in y direction:

2. ListPointPlot3D + DisplayFunction

ListPointPlot3D[d,
DisplayFunction -> (Show @* ReplaceAll[Point -> Line])]


Use GatherBy to group input data by the y values to get

ListPointPlot3D[GatherBy[Join @@ d, #[[2]] &],
DisplayFunction -> (Show@*ReplaceAll[Point -> Line])]


3. ListPointPlot3D + post-processing

lpp3d = ListPointPlot3D[d]


lpp3d /. p_Point :> {p, Line @@ p}


ListPointPlot3D[GatherBy[Join @@ d, #[[2]] &]] /. p_Point :> {p, Line @@ p}


Assume that your data has the form: {{{x1,y,z},{x1,y,z}..},{{x2,y,z},..},..} where the x coordinates are the same for all points on the same line.

We may create some test data like:

d = Table[{x, y, RandomReal[3 {-1, 1}]}, {x, 5}, {y, 20}];


To draw every line in a different color, we use "Hue" and a count:

c = 0;
Graphics3D[{Hue[0.2 c++], Line[#]} & /@ d, Axes -> True,
AspectRatio -> .5, AxesLabel -> {"x", "y", "z"}]


Feel free to adjust the parameters like AspectRatio, Labels and Hue to your needs.

• Hey thanks for your answer! Unfortunately the data points are not structured in such a way and due to the nature of the code it might take a small effort to re-write the export procedure from python, but it might just be worth it though. Isn't there a way to just take a bunch of points, plot them, and then run a mesh in one direction (Hue doesn't matter btw), let's say the x direction? What I'm thinking is that since the default is to have meshes in both x and y, I'd be asking to remove the y-lines but keep the lines in the x direction. Thanks for taking time to answer, I appreciate it! Commented Apr 29, 2021 at 15:56
• I only draw lines, with this, a mesh will be points. If you want to have mesh-lines, you need to draw a surface, but if I understood correctly, you do not want to draw a surface. A way around this: draw a surface and mesh in x-direction and set the opacity of "PlotStyle" to zero. Then you only see the gridlines without the surface. Commented Apr 29, 2021 at 16:09

Maybe I’ve misunderstood this, but...using the example data from DanielHuber’s answer:

SeedRandom[1];
d = Table[{x, y, RandomReal[3 {-1, 1}]}, {x, 5}, {y, 20}];


We can simply use the new in 12.3 ListLinePlot3D:

ListLinePlot3D[d]


To get the other orthogonal direction, with your formatting of list we can simply take the Transpose of the list:

ListLinePlot3D[Transpose[d]]