FixYa.com
Technical Support, Instructions & Repair Service


Tags:

IBM

Simple but puzzling plotting question

By Phoebe - usenet poster


I simply want to plot three currency daily exchange rates, USD, GBP and EURO, from April 1, 1990 to March 31, 2006. The problem is the EURO. Since it only came into existence on 01 January 1999, I don't have data going as far back as 1990. Therefore, for the Euro column, all entries for the period April 1, 1990 to December 31, 1998 are blank. Unfortunately, this causes a partw error in Mathematica. Does anyone know how to plot different sized datasets on the same graph?

This Problem has been added to the Share Your Expertise Page under "My Work Queue".
Solution #1
posted on Aug 01, 2007
Not Rated (0)

Bouncy

Bouncy - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
Here's an example from Help for DateListPlot:

data1 = {{{2006, 10, 1}, 10}, {{2006, 10, 15}, 12}, {{2006, 10, 30},
15}, {{2006, 11, 20}, 20}};
data2 = {{{2006, 10, 5}, 15}, {{2006, 10, 20}, 8}, {{2006, 11, 10},
5}, {{2006, 11, 15}, 1}};
DateListPlot[{data1, data2}, Joined -
The same sort of thing works for ListPlot, too.

Bobby

--

Was this solution helpful? Show your Appreciation by rating it:

Solution #2
posted on Aug 01, 2007
Not Rated (0)

Joey2

Joey2 - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
Hi,

You can do this only if each of the data sets use the same x-coordinate.

l1 = Table[{x, Sin[Pi x]}, {x, -Pi, Pi, Pi/8}];
l2 = Table[{x, Cos[Pi x]}, {x, -Pi, 0, Pi/12}];
l3 = Table[{x, Tan[Pi x]}, {x, 0, Pi, Pi/16}];
ListPlot[{l1, l2, l3}, Joined -
In your case, you'd want to plot each of your currencies as they vary with
date.

Regards,

Dave.

Was this solution helpful? Show your Appreciation by rating it:

Solution #3
posted on Aug 01, 2007
Not Rated (0)

jessie25

jessie25 - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
If you want the data correctly aligned on the right hand side and no
annoying zeros on the left, one can use an index (or rescale an existing
index: that all depends on the actual data structure you are using) as
in the following example:

data1 = {54.8, 54.6, 54.78, 56.19, 56.97, 57.16, 57.7, 57.72, 56.28,
56.78, 56.63, 55.77, 54.92, 55.6, 54.86, 53.6, 53.54, 53.49, 53.39,
51.59, 53.2, 55.09};
data2 = {89.89, 89.01, 89.39, 88.89, 88.18, 87.41, 86.84, 87.07, 87.06,
88.05, 88.22, 88.55, 88.13, 88.2, 88.89};

data1 = Table[{i, data1[[i]]}, {i, Length[data1]}];
data2 = Table[{i + Length[data1] - Length[data2], data2[[i]]},
{i, Length[data2]}];

<< "Graphics`MultipleListPlot`"
MultipleListPlot[{data1, data2}]

Regards,
Jean-Marc

Was this solution helpful? Show your Appreciation by rating it:

Solution #4
posted on Aug 01, 2007
Not Rated (0)

paulrmc

paulrmc - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
Using version 6, this can be done easily as follows:

First generate two data sets of differing length:

set1 = Sort@Table[RandomReal[], {5}];
set2 = Sort@Table[RandomReal[], {10}];

then plot them:

ListPlot[{set1, set2}, Joined -
Or if you are using version 5.x, you can get a similar result with:

set1 = Sort@Table[Random[], {5}];
set2 = Sort@Table[Random[], {10}];

Show[
Block[{$DisplayFunction=Identity},
{ListPlot[set1, PlotJoined- ListPlot[set2, PlotJoined- PlotRange- --
To reply via email subtract one hundred and four

Was this solution helpful? Show your Appreciation by rating it:

Solution #5
posted on Aug 01, 2007
Not Rated (0)

kioner

kioner - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
In version 5.2, you could use *MultipleListPlot* and *PadLeft* with 0
the missing data to get lists of equal length. (Note that
*MultipleListPlot* will plot lists of different length but the smaller
list will be padded on the right. See below.) For instance,

In[1]:=
data1 = {54.8, 54.6, 54.78, 56.19, 56.97, 57.16,
57.7, 57.72, 56.28, 56.78, 56.63, 55.77, 54.92,
55.6, 54.86, 53.6, 53.54, 53.49, 53.39, 51.59,
53.2, 55.09};
data2 = {89.89, 89.01, 89.39, 88.89, 88.18, 87.41,
86.84, 87.07, 87.06, 88.05, 88.22, 88.55, 88.13,
88.2, 88.89};
Length /@ {data1, data2}

Out[3]=
{22, 15}

In[4]:=
<< "Graphics`MultipleListPlot`"
MultipleListPlot[{data1, data2}]
data3 = PadLeft[data2, Length[data1]];
MultipleListPlot[{data1, data3}]

Regards,
Jean-Marc

Was this solution helpful? Show your Appreciation by rating it:

Solution #6
posted on Aug 01, 2007
Not Rated (0)

lawyer

lawyer - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
In version 6.0, *DateListPlot* manages very well to plot lists of
various sizes, as you can see in the following example.(A demo notebook
and a PDF file are available at
#
#
respectively.)

In[1]:= ms = FinancialData["MS", {"March 1, 2005", "March 31, 2005"}]
ibm = FinancialData["IBM", {"March 10, 2005", "March 31, 2005"}]
Length /@ {ms, ibm}
DateListPlot[{ms, ibm}, Joined -
Out[1]= {{{2005, 3, 1}, 54.8}, {{2005, 3, 2}, 54.6}, {{2005, 3, 3},
54.78}, {{2005, 3, 4}, 56.19}, {{2005, 3, 7}, 56.97}, {{2005, 3, 8},
57.16}, {{2005, 3, 9}, 57.7}, {{2005, 3, 10},
57.72}, {{2005, 3, 11}, 56.28}, {{2005, 3, 14},
56.78}, {{2005, 3, 15}, 56.63}, {{2005, 3, 16},
55.77}, {{2005, 3, 17}, 54.92}, {{2005, 3, 18},
55.6}, {{2005, 3, 21}, 54.86}, {{2005, 3, 22},
53.6}, {{2005, 3, 23}, 53.54}, {{2005, 3, 24},
53.49}, {{2005, 3, 28}, 53.39}, {{2005, 3, 29},
51.59}, {{2005, 3, 30}, 53.2}, {{2005, 3, 31}, 55.09}}

Out[2]= {{{2005, 3, 10}, 89.89}, {{2005, 3, 11},
89.01}, {{2005, 3, 14}, 89.39}, {{2005, 3, 15},
88.89}, {{2005, 3, 16}, 88.18}, {{2005, 3, 17},
87.41}, {{2005, 3, 18}, 86.84}, {{2005, 3, 21},
87.07}, {{2005, 3, 22}, 87.06}, {{2005, 3, 23},
88.05}, {{2005, 3, 24}, 88.22}, {{2005, 3, 28},
88.55}, {{2005, 3, 29}, 88.13}, {{2005, 3, 30},
88.2}, {{2005, 3, 31}, 88.89}}

Out[3]= {22, 15}

Out[4]= [... plot deleted ...]

Regards,
Jean-Marc

Was this solution helpful? Show your Appreciation by rating it:

Can you Help with these Modems problems?

Modems
integers powers roots
does 2?+¹=2?*2¹ Answer This...
Modems
moden of huawei ETS 2288 WLL
kindly show me that where from... Answer This...
Modems
Pilotes du modem CDMA
Je n'arrive pas ? installer la... Answer This...
Modems
dynex model dx-4p2h
I bought this device and when i... Answer This...
Modems
fgffgjhg
7987987987 Answer This...
Repair Service
Find Modem Repairman Near You:

FixYa does not evaluate or guarantee the accuracy of any information provided through its proposed solutions, posts, or Expert Assistance Sessions. By entering this site you declare you read and agreed to its Terms. You may NOT copy or distribute the content that appears on this site without written permission from FixYa Inc.
© 2005-2008, FixYa, Inc. or its affiliates
When the original poster rates a solution that was given to his own problem, that rating is locked!
X

Are you sure the solution content is Inappropriate?
   
Tech buddies can communicate directly to answer questions. Become a Tech Buddy and have direct access to your favorite expert for FREE!