MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Legend for DateListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100033] Re: [mg100004] Legend for DateListPlot
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 22 May 2009 01:45:03 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Instead of using a legend you could label the lines

DateListPlot[{
  Tooltip[FinancialData["MSFT", "2006"], "Microsoft Corporation"],
  Tooltip[FinancialData["SNE", "2006"], "Sony Corporation"],
  Tooltip[FinancialData["AKAM", "2006"], "Akamai Technologies Inc"]},
 Joined -> True, 
 ImageSize -> 500,
 Epilog -> {
   Text[Style["Microsoft Corp", 12], {{2006, 7, 1}, 19}],
   Text[Style["Sony Corp", 12], {{2006, 5, 1}, 53}],
   Text[Style["Akamai Technologies Inc", 12], {{2006, 8, 5}, 33}, {-1,
      0}]}]


Bob Hanlon

---- greg.mcavoy at gmail.com wrote: 

=============
I would like to add a PlotLegend to a time series plot like the one
below.
DateListPlot[{Tooltip[FinancialData["MSFT", "2006"],
   "Microsoft Corporation"],
  Tooltip[FinancialData["SNE", "2006"], "Sony Corporation"],
  Tooltip[FinancialData["AKAM", "2006"], "Akamai Technologies Inc"]},
 Joined -> True]

I tried using the PlotLegends package, but it doesn't appear to work
with DateListPlot
(code below)
Needs["PlotLegends`"]

DateListPlot[{FinancialData["MSFT", "2006"],
  FinancialData["SNE", "2006"], FinancialData["AKAM", "2006"]},
 Joined -> True,
 PlotLegend -> { "Microsoft Corporation", "Sony Corporation",
   "Akamai Technologies Inc"}]

Is there a work around to this problem or something wrong with my
code?  I want to export the graph to for use in a latex document so
Tooltip is not a useful option.




  • Prev by Date: Re: Are you wolfing tonight?
  • Next by Date: Animated Bubble Chart
  • Previous by thread: Re: Legend for DateListPlot
  • Next by thread: Re: Legend for DateListPlot