Regardless of the situation,
the basic strategy for creating legends is to "link" one or more
plot statements to a legend statement by assigning a unique, case-sensitive
name to the plot statement and then referencing that name on the legend
statement:
plot-statement . . . / name="id-string1" ;
plot-statement . . . / name="id-string2" ;
legend-statement "id-string1" "id-string2" < / options > ;
One way of thinking about this syntax is that you can
identify any plot with a NAME= option, and you can then selectively
include plot names on a legend statement. This enables the legend
to query the identified plots so that it can get the information that
it needs to build the legend entries.
Note: When the legend statement
includes the name of a plot, it does not always mean that the legend
will include an entry for that plot. For example, a block plot with
FILLTYPE=ALTERNATE does not show up in a legend.