# Discrete 3D Plot with date on one axis

1) How do I plot the following data in 3D (large data, only a part of it is used here):

{
{"date", "v1", "v2"},
{{2000, 6, 16, 0, 0, 0.}, 10.4324, 11.084},
{{2000, 6, 30, 0, 0, 0.}, 9.75499, 11.02},
{{2000, 7, 14, 0, 0, 0.}, 10.0905, 10.932},
{{2000, 7, 28, 0, 0, 0.}, 10.2406, 11.249},
{{2000, 8, 11, 0, 0, 0.}, 10.1241, 11.411},
{{2000, 8, 25, 0, 0, 0.}, 9.92124, 11.4},
{{2000, 9, 8, 0, 0, 0.}, 8.63775, 11.566},
{{2000, 9, 22, 0, 0, 0.}, 8.52399, 11.507},
{{2000, 10, 6, 0, 0, 0.}, 9.09311, 11.635},
{{2000, 10, 20, 0, 0, 0.}, 8.68255, 11.626},
{{2000, 11, 3, 0, 0, 0.}, 8.19321, 11.696},
{{2000, 11, 17, 0, 0, 0.}, 9.47059, 11.296},
{{2000, 12, 1, 0, 0, 0.}, 9.75926, 11.469},
{{2000, 12, 15, 0, 0, 0.}, 10.0035, 11.343},
{{2000, 12, 29, 0, 0, 0.}, 9.5563, 10.946},
{{2001, 1, 12, 0, 0, 0.}, 9.66618, 10.67},
{{2001, 1, 26, 0, 0, 0.}, 9.57756, 10.57},
{{2001, 2, 9, 0, 0, 0.}, 9.47097, 10.33},
{{2001, 2, 23, 0, 0, 0.}, 8.86714, 10.11}
}


2) I want to see how data evolves as time changes. How do I use Manipulate to do this?

-
Could you tell us which data should be on x-, y-, and z-axis? Regarding the second question: Why don't you convert your dates to simple numbers (e.g. hours) and plot then these dates and v1 or v2 with ListPlot? then you see how v1 and v2 changes with time. – partial81 May 16 '13 at 21:23

I would convert first your data, so that you can handle them in an easier way. First I skip the information about the columns (the header) with

data2 = data[[2 ;; -1]];


then I convert the times (year, month, date, etc.) with something like

data3 = Transpose[{data2[[All, 1, 1]] + data2[[All, 1, 2]]/12 +
data2[[All, 1, 3]]/(12*31), data2[[All, 2]], data2[[All, 3]]}];


and add the other columns into data3 again.

The rest is easy:

Use ListPlot3D[data3, AxesLabel -> {"time", "v1", "v2"}] for your 3D-plot. And ListPlot[data3[[All, {1,2}]], AxesLabel -> {"time", "v1"}] to plot v1 as function of the time (change {1,2} to {1,3} for v2). If you really want to use Manipulate, try something like Manipulate[ ListPlot[data3[[1 ;; a, {1, 3}]]], {a, 1, Length[data3], 1}].

You could also work without converting your dates. Then you could use DateListPlot[data2[[All, {1, 2}]]] or similar. But I fear that you need to convert your dates for the ListPlot3D.

-

If you're set on having 3D data, then, as @partial81 has pointed out, just give your data a little massage and then use ListPlot3D.

dates2000 =
data /. {{yr_, mo_, d_, h_, mi_, s_}, x_, y_} :> {
DateDifference[
DateList[{2000, 1, 1}],
AbsoluteTime[{yr, mo, d, h, mi, s}]],
x, y}

ListPlot3D[dates2000]


However, I think this is quite hard to read, especially when not interactive, and you can't really see what the data is trying to tell you. So to me this looks better:

dates = Transpose[
data /. {{yr_, mo_, d_, h_, mi_, s_}, x_, y_} :>
{
{DateString[{yr, mo, d, h, mi, s}], x},
{DateString[{yr, mo, d, h, mi, s}], y}
}]
DateListPlot[dates,
Joined -> True,
Filling -> {1}]


-