I have a list density plot from a list ls={{x1,y1,z1},{x2,y2,z2}}...
. How can I extract the line density with a fix y
, such that I could get a ListPlot
{{xi,zi},{xj,zj}}...
. Please start from list ls
or the graph p1
, avoid using the functions, they are only used to generate the list.
The graph in ListDensityPlot is smooth, so I would require the ListPlot also be smooth. However, the list ls
may not be very dense. Below is the code creating the list and ListDensityPlot:
(*Creating a list ls*)
f[x_] := Sqrt[1 - x];
stepSize = 100/1000;
ls0 = Table[{x, f[x]}, {x, 0, 1, stepSize}];
ls1 = Flatten[
Table[{#[[1]], y, Exp[y - #[[2]]] - 1}, {y, #[[2]], 1.5,
stepSize}] & /@ ls0, 1];
ls2 = Flatten[
Table[{#[[1]], y, 0}, {y, 0, #[[2]], stepSize}] & /@ ls0, 1];
ls = Join[ls1, ls2];
(*Draw the ListDensity of ls*)
p1 = ListDensityPlot[ls, PlotLegends -> Automatic];
p2 = Plot[{0.83, 1.14}, {x, 0, 1},
PlotStyle -> {{Dashed, Red}, {Dashed, Green}}];
Show[p1, p2]
ListPointPlot3D[ls]
For example, how to extract the red and green dashed line smoothly?
It can be seen that the points may not be dense.
f[x]
is undefined. $\endgroup$ls
$\endgroup$List
that goes into theDensityPlot
acceptable, or do you wish the extracted data to be from theDensityPlot
itself? $\endgroup$