all.
I read several previous message at stackoverflow, and went through the documentation of zoo and ggplot2 but didn't find any suitable answer.
Say I have a zoo object called 'data'. The original data in the flat file are as follows:
Date,Quote1,Quote2,Quote3,Quote4,Quote5
18/07/2008,42.36,44.53,28.4302,44.3,42
21/07/2008,43.14,44.87,28.6186,44.83,43.27
22/07/2008,43.26,44.85,28.6056,44.86,42.84
23/07/2008,44.74,45.61,29.7558,45.69,#N/A
24/07/2008,43.99,45.14,29.2944,45.19,#N/A
25/07/2008,43.18,45.33,29.4569,45.46,43.65
28/07/2008,43.45,44.72,28.5016,44.89,43.31
29/07/2008,43.49,44.8,28.1247,44.88,42.85
30/07/2008,44.55,45.54,28.0727,45.58,43.67
31/07/2008,43.36,45.5,27.9818,45.63,43.91
01/08/2008,43.34,44.75,28.0792,44.69,43.04
Now, I want to plot the time series of this five financial products on a single line graph so that to compare their evolution.
I wish to use the ggplot2.
Would anyone be kind to give me some hints?
If data
is your zoo object then try this (and see ?autoplot.zoo
for more info):
p <- autoplot(data, facet = NULL)
p
or perhaps this since I don't think the automatic varying of linetype
looks so good with this many series in the same panel:
p + aes(linetype = NULL)