Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: '3D plot with Date on one axis' topicStudent Support Forum > General > "3D plot with Date on one axis"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
05/11/13 5:51pm

In[1]:= d = Rest[{{"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}}];

In[2]:= dv1 = Map[{#[[1]], #[[2]]} &, d];(*Extract column 1 and 2*)
ddv1 = Map[{#[[1, 1]], #[[3, 2]]/#[[1, 2]]} &, Partition[d, 3, 1]];(*Break into overlapping groups of 3 and extract columns*)
ddv2 = Map[{#[[1, 1]], #[[3, 3]]/#[[1, 3]]} &, Partition[d, 3, 1]];

In[4]:= Manipulate[DateListPlot[Take[dv1, {i, i + 5}], Joined -> True], {i, 1, Length[dv1 - 5], 1}]

Out[4]= ...ManipulateSnipped...

In[5]:= Manipulate[DateListPlot[Take[ddv1, {i, i + 5}], Joined -> True], {i, 1, Length[ddv1 - 5], 1}]

Out[5]= ...ManipulateSnipped...

In[6]:= Manipulate[DateListPlot[{Take[ddv1, {i, i + 5}], Take[ddv2, {i, i + 5}]}, Joined -> True], {i, 1, Length[ddv1 - 5], 1}]

Out[6]= ...ManipulateSnipped...

Note: If you move the slider too far to the right then it tries to generate a plot "off the right end" of the data, even though the Manipulate variable has been given an upper limit that seems like it should not be able to do that. So either I have made a silly mistake OR there is something I have not been able to see despite reading the documentation OR there is a problem. It does draw your plots, but use this with care. If someone does find the reason why this fails then please post an explanation. Thank you.

URL: ,

Subject (listing for '3D plot with Date on one axis')
Author Date Posted
3D plot with Date on one axis mv 05/11/13 09:19am
Re: 3D plot with Date on one axis Bill Simpson 05/11/13 5:51pm
Re: Re: 3D plot with Date on one axis mv 05/12/13 01:31am
Re: Re: Re: 3D plot with Date on one axis Bill Simpson 05/12/13 11:48pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic