There are 2 main ways to display legends using Image_Graph.
As a box, overlayed on the plotarea
As a box, displayed somewhere besides/above/below the plotarea
The 1st way will display a box that is placed (by default in the upper-right corner) of the plotarea. This is the
easiest way to add the legend:
Note that a Image_Graph_Legend is added to a PlotArea.
By displaying the legend in the upper-right corner it could overlap your plot hiding information. However you have
the possibility to display the legend in another "corner" of the plot.
This will make it appear in the bottom-left corner of the plot. Use IMAGE_GRAPH_ALIGN_BOTTOM, IMAGE_GRAPH_ALIGN_TOP,
IMAGE_GRAPH_ALIGN_LEFT and IMAGE_GRAPH_ALIGN_RIGHT for corner positions.
The 2nd way is (slightly) more complex, but will allow you to,display legends "outside" the plot, thereby not overlapping.
This is done in the same using layouts (Plot Layout).
Note that you have to link the Image_Graph_Legend to the Image_Graph_Plotarea explicitly.
In the 1st option, this is done implicitly, since you add the legend to the plotarea. Using this method you add
the legend to a (in this case) Image_Graph_Layout_Vertical which is added to a Image_Graph,
leaving the legend with "no idea" of what plot to show legend for. So you need to have the $Legend->setPlotArea($Plotarea);
for things to work..
This will also give the possibility to place the legend wherever you want, fx:
Which will cause the Image_Graph_Legend to be displayed in the lower-right eigth' of the graph,
where the linked Image_Graph_Plotarea is displayed in the upper half