0
$\begingroup$

I have a set of 3D points, the first coordinate of which, say, is confined to the values 0 and 1, while the other two can assume values within the unit interval [0,1]. ListPlot3D shows a continuous variation of the first value--which perhaps is somewhat misleading.

Can I represent the discreteness of the first coordinate, while simultaneously showing the continuous nature of the other two?

What's appropriate if the set is only 2D, the first coordinate of which, again is confined to the values 0 and 1, while the other ONE can assume values within the unit interval [0,1]?

$\endgroup$
1
  • 1
    $\begingroup$ something like SeedRandom[1]; n = 40; xyz = Transpose[{RandomChoice[{0, 1}, n], RandomReal[1, n], RandomReal[1, n]}]; ListPointPlot3D[SortBy[First] /@ GatherBy[xyz, First]] /. p_Point :> {p, Line @@ p}? $\endgroup$
    – kglr
    May 24, 2021 at 1:13

1 Answer 1

1
$\begingroup$

Your data lay in 2 planes: {0,x,y} and {1,x,y}, so they are essentially 2 dimensional. Therefore we may display this in 2D as 2 separate plots or in one plot where the sign of the coordinates of one plane is inverted. E.g:

n = 20;
d1 = RandomReal[{0, 1}, {n, 2}];
d2 = -1 RandomReal[{0, 1}, {n, 2}];
ListPlot[Join[d1, d2]]

enter image description here

Of course you may also plot them in 3D:

n = 20;
d1 = Table[{0, RandomReal[{0, 1}], RandomReal[{0, 1}]}, n];
d2 = Table[{1, RandomReal[{0, 1}], RandomReal[{0, 1}]}, n];
ListPointPlot3D[Join[d1, d2]]

$\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.