From: Thomas Melehan on
Does anyone know if there any undocumented PlotLegend type functions that work in a DateListPlot? Using ShowLegend is too much work.

From: Darren Glosemeyer on
Thomas Melehan wrote:
> Does anyone know if there any undocumented PlotLegend type functions that work in a DateListPlot? Using ShowLegend is too much work.
>

In current released versions, PlotLegend will work with DateListPlot if
the date coordinates are AbsoluteTimes. The package code did not know
how to handle data with DateList and DateString coordinates, but this is
fixed in the version of Mathematica currently under development. For
now, converting date coordinates to AbsoluteTimes will provide a
workaround. Here is an example of how this can be done.

<< PlotLegends`

data = FinancialData["AAPL", {2008, 11, 1}];

(* convert date coordinates to absolute times *)
newdata = data;
newdata[[All, 1]] = Map[AbsoluteTime, newdata[[All, 1]]];

(* plot the new data with a legend *)
DateListPlot[newdata, PlotLegend -> {"AAPL"}]

(* add legend options as desired *)
DateListPlot[newdata, PlotLegend -> {"AAPL"},
LegendPosition -> {-1.1, -1}]


Darren Glosemeyer
Wolfram Research