A discrete legend consists
of one or more units called legend entries. Each legend entry consists
of a legend symbol and a legend value. The legend symbol is typically
a marker, line, or filled symbol that represents a specific area in
the plot. The legend value is descriptive text that is derived from
group values, or assigned with the plot’s LEGENDLABEL= option,
or with the
LEGENDITEM statement’s LABEL= option.
To specify a discrete legend, you can use the DISCRETELEGEND statement.
To consolidate legend entries for common grouped values that are represented
by two separate plots, you can use the MERGEDLEGEND statement.
For grouped plots, a discrete
legend represents all of the values that are present in the data.
To ensure that legend entries are displayed for group values, regardless
of whether those values are present in the data, you can define an
attribute map for the group values. You can then specify that attribute
map directly in the DISCRETELEGEND statement. For more information
and an example, see the DISCRETEATTRMAP statement’s
Statement Summary.
Note: An attribute map cannot be
referenced directly in a MERGEDLEGEND statement.
The DISCRETELEGEND statement
can specify one or more names that reference the source for the legend
entry values. You can use the
TYPE= option to control the visual attributes for the legend
display. The TYPE= option is required when you specify an attribute
map directly in the DISCRETELEGEND statement.
For legend items that
represent fills or colors without a specific shape, a filled symbol
with a one pixel, solid outline is used to represent the data values.
If the feature being represented by the legend item has an outline,
the default outline color is derived from the feature’s outline
color. If the feature does not have an outline, the default outline
color for its corresponding legend entry is derived from the GraphOutline
style-element.
The MERGEDLEGEND statement
can be used to consolidate lines and marker symbols from discrete
legend entries when a graph displays grouped values for exactly two
plots. With a MERGEDLEGEND statement, the legend values from the group
variables in two plots are compared. For each common value, the corresponding
legend lines and marker symbols are combined, creating only one legend
entry for each matching set of group values. The MERGEDLEGEND statement
can be used only for grouped plots and must specify two names that
reference the source for the legend entry values.
Within an overlay-type
layout, when a discrete legend is placed inside the plot area with
LOCATION=INSIDE,
-
The discrete legend is always placed
on top of plot lines and markers.
-
By default, its background is fully
transparent (
OPAQUE=FALSE), meaning that underlying lines,
markers, and data labels show through the legend.
-
Its position can be controlled
with the
AUTOALIGN= option, or with the
HALIGN= and
VALIGN= options. (The AUTOALIGN= option is
not available in a LAYOUT OVERLAY3D statement.)
Within an overlay-type
layout, when a discrete legend is placed outside the plot area with
LOCATION=OUTSIDE,
-
By default, its background is fully
opaque (OPAQUE=TRUE).
-
Its position can be controlled
with the HALIGN= and VALIGN= options.
When a discrete legend
is placed within nested layouts, it might be necessary to do one of
the following to obtain the desired legend organization:
-
-
use the
DOWN= option and also set ORDER=COLUMNMAJOR
A legend might be dropped
if the total legend area in the graph exceeds the percentage that
is set by the MAXLEGENDAREA= option in an ODS GRAPHICS ON statement
that is in effect for the output destination. A legend might also
be dropped if
DISPLAYCLIPPED=FALSE and the full legend cannot be
displayed.