Re: Simple but puzzling plotting question
- To: mathgroup at smc.vnet.net
- Subject: [mg78604] Re: Simple but puzzling plotting question
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 5 Jul 2007 04:03:59 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f6fr2l$8s1$1@smc.vnet.net>
ouadad wrote: > 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? > 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