# Why doesn't ListPointPlot3D plot a Table's output that iterates over three variables? [closed]

Why does ListPointPlot3D accept tables with 3 outputs and 2 variables such as:

Table[{a,b,1},{a,-1,1},{b,-1,1}]
ListPointPlot3D[Table[{a,b,1},{a,-1,1},{b,-1,1}]]


but doesn't accept tables with 3 outputs and 3 variables?

Table[{a,b,c},{a,-1,1},{b,-1,1},{c,-1,1}]
ListPointPlot3D[Table[{a,b,c},{a,-1,1},{b,-1,1},{c,-1,1}]]


Am I doing something wrong or is Mathematica stupid?

• Welcome to the Mathematica Stack Exchange. The introductory book written by the inventor is a good learning resource. There is a fast intro for math students as well as a fast intro for programmers to choose from.
– Syed
Jun 16 at 14:34
• Try: t2 = Flatten[Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}], 2] and ListPointPlot3D[t2] OR t3 = Flatten[Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}], 1] and ListPointPlot3D[t3].
– Syed
Jun 16 at 14:36
• Ah that works altho I dont understand why. Thanks Jun 16 at 14:46
• Run Dimensions on the outputs of your Table expressions to see the structure of the lists being generated, and compare those with the allowable inputs for ListPointPlot3D mentioned in the documentation. As an alternative to your second example, consider Tuples[Range[-1, 1], 3] instead. Jun 16 at 15:29

To see why the approaches given in Syed's comment work, compare the Dimensions of the Tables

Clear["Global*"]

Dimensions[t1 = Table[{a, b, 1}, {a, -1, 1}, {b, -1, 1}]]

(* {3, 3, 3} *)


There are three lists of three data points

ListPointPlot3D[t1, PlotLegends -> Automatic]


Dimensions[t2 = Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}]]

(* {3, 3, 3, 3} *)


This dataset does not match any allowed syntax for ListPointPlot3D

ListPointPlot3D[t2]

(* ListPointPlot3D::ldata: {{{{-1,-1,-1},{-1,-1,0},{-1,-1,1}},{{-1,0,-1},{-1,0,0},{-1,0,1}},{{-1,1,-1},{-1,1,0},{-1,1,1}}},{<<1>>},{<<1>>}} is not a valid dataset or list of datasets. *)

Dimensions[
t3 = Flatten[Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}], 2]]

(* {27, 3} *)


This is a single list of 27 data points

ListPointPlot3D[t3, PlotLegends -> Automatic]


Dimensions[
t4 = Flatten[Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}], 1]]

(* {9, 3, 3} *)


This is nine lists of three data points

ListPointPlot3D[
Flatten[Table[{a, b, c}, {a, -1, 1}, {b, -1, 1}, {c, -1, 1}], 1],
PlotLegends -> Automatic]
`