Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let me just first say I am not actually trying to find a function for these set of data. All I am doing is joining the points to make a line.

Basically let's say I have some data, which I cleverly will call/name them as 'data' in Mathematica.

data:= {{1,0,0},{2,4,7},{2,6,7},{0,0,23}}

Now plotting them. (FYI, these data points are randomlly chosen)


I should get a plot, but of course they are all disconnected. What I want to do is to join them. Unfortunately 'Joined -> True' does not exists in ListPointPlot3D, so I do not know how to join them

Any ideas?


At the moment, I have a recursion. I will just show you the table

For instance

Table[x[n, t], {n, 1, 10}] 

prints out a list of 10 data points in 3D. It will not work with Graphics3D


I will write out exactly what I have

x[1, t_] := {0,0,0};

A[t_] := {{1, -t, 1}, {t, 2, 0}, {0, 0,t}}

B[t_] := Inverse[A[t]];

x[n_Integer, t_] /; n > 0 := B[t].x[n - 1, t];

Table[x[n, t], {n, 1, 10}]

I want to plot the points and join them in a curve. If possilbe I would even like to manipulate the plot. The range for $t \in [0,1]$

Everything updated

share|improve this question
You could just use Graphics3D[Line[data]]... – J. M. Apr 7 '13 at 18:12
What do you mean by "it will not work"? – Jens Apr 7 '13 at 18:36
It gives me an error. I will write out the code. – Hawk Apr 9 '13 at 0:04
Your definition for A[t_] is circular, it can't work ... and you have two defs for the same thing (A[t_]) – Dr. belisarius Apr 9 '13 at 0:26
I made a typo, one sec – Hawk Apr 9 '13 at 0:54
t := RandomReal[]
x[n_, t_] := Sin@t
data = Table[{n, #, x[n, #]} &[t], {n, 1, 10}];

Graphics3D[{Line@data, PointSize[Large], Point@data}, 
           PlotRange -> ({Min@# - 1, Max@# + 1} & /@ Transpose@data), Axes -> True]

enter image description here


Also something like this shall do

f = Interpolation[#, InterpolationOrder -> 1] & /@ Transpose@data;
Show[{ParametricPlot3D[Through[f[t]], {t, 1, Length@data}], 
      Graphics3D[{PointSize[Large], Point@data}]}]

enter image description here

share|improve this answer
OKay it connects them, but now I lose my points. I want to see the dots as well. You see what I mean? – Hawk Apr 7 '13 at 18:20
@jak See edit, please – Dr. belisarius Apr 7 '13 at 18:23
There is also one other problem, which I will edit in OP. – Hawk Apr 7 '13 at 18:26
see edit 10 chat – Hawk Apr 9 '13 at 0:10

Of course the Graphics3D approach in belisarius' answer is very general and should always work. But maybe you want to stick with ListPointPlot3D for some reason. Then you could use Show to combine the isolated points with a plot of the linear Interpolation between the points:

data = {{1, 0, 0}, {2, 4, 7}, {2, 6, 7}, {0, 0, 23}}

(* ==> {{1, 0, 0}, {2, 4, 7}, {2, 6, 7}, {0, 0, 23}} *)

iData = 
  Interpolation[Transpose[{Range[Length[#]], #} &@data], 
   InterpolationOrder -> 1];

 ListPointPlot3D[data], ParametricPlot3D[iData[t], {t, 1, 4}]

Show plots

It's worth mentioning here that Show always uses the options of the plot that comes first in the list, unless you specify additional options to Show (such as BoxRatios, if desired). You can also control the style of the points and curve separately using the usual options.

share|improve this answer
I always doubt when formatting a 3D list for feeding it into Interpolation. Sometimes I do like you did, and sometimes as in my answer here. Do you have any thoughts about what is the better way? – Dr. belisarius Apr 7 '13 at 20:25
I would have used your method, that's why I upvoted it... My answer was just motivated by the apparent "other problem" of the OP, which I don't understand yet. – Jens Apr 7 '13 at 20:48
As I understand it, he has {f1, f2, f3, ...} instead of {{x1,y1,f1} , {x2,y2,f2}, ...} – Dr. belisarius Apr 7 '13 at 20:50
@belisarius For what it's worth I would write: Interpolation @ MapIndexed[{#2, #} &, data] – Mr.Wizard Apr 8 '13 at 11:08
See edit 10 char – Hawk Apr 9 '13 at 0:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.