|
DESCRIPTION
Defines one legend entry.
This entry will be rendered the next time that
proc legend is executed.
Usually, legends are built by successive plotting procs
having a legendlabel attribute. However, if additional
flexibility is needed to make custom legend entries, this
proc may be invoked, once per legend entry.
For example, if a scatterplot is being created with various sized
points, there is no automatic way to get a legend of the various
point sizes, so proc legendentry could be executed (probably several
times) to define legend information, then proc legend could be
executed to render it.
proc legendentry is also useful in setting up
legend-driven plots
which allow things like bar color, or scatterplot symbol color, size, or
shape to be controlled by a data field.
EXAMPLE
See the gallery example
scatterplot3a
PREREQUISITES
None.
MANDATORY ATTRIBUTES
None.
ATTRIBUTES
sampletype t
-
-
The type of sample to be displayed with the entry.
t may be one of:
line, color , symbol , text , line+symbol , or
text+symbol, or none.
none may be used to insert spacing or text headers/separators into the legend.
Example: sampletype: text
label
text
-
-
The label for the entry.
Example: label: Eastern counties
tag
string
-
-
An optional short identifier to be associated with the entry,
so that the entry can be accessed later.
Used with proc bars colorfield, as in this example:
colorfld
details
text
-
-
Details regarding the rendering of the sample.
What this is depends on the sampletype.
-
-
For line, a
linedetails
specification should be given.
-
-
For color, a
color
should be given.
-
-
For symbol, a
symboldetails
specification should be given.
-
-
For text, the character or word should be given here, and a
textdetails
specification may be given using the details2 attribute.
-
-
For line+symbol, a
linedetails
specification should be given here,
and a
symboldetails
specification given using the details2 attribute.
-
-
For text+symbol, the character or word should be given here, a
textdetails
specification should be given using the details2 attribute,
and a
symboldetails
specification given using the details3 attribute.
-
-
If sampletype is none, nothing should be given for this attribute.
details2
text
-
-
Secondary details attribute. See details above.
details3
text
-
-
See details above.
LEGEND-DRIVEN TECHNIQUE
"Legend-driven technique" allows
bar color, scatterplot symbol, etc. to be controlled by a data field.
This technique involves defining a legend first, containing information
to associate data field contents with appearance details.
Then the plotting is done.
Here is the procedure:
-
-
1. For every expected variation,
set up an explicit legend entry using proc legendentry.
label, tag, and details attributes should be supplied.
The tag will be compared with data field contents.
The details attributes control appearance.
-
-
2. Plot, using the appropriate attribute. For example, if you are
doing a bar graph where individual bar colors are controlled by a data
field, you would use proc bars and specify a colorfield.
Examples of legend-driven technique are
colorfld
symfld
symfld
dupsleg
|
data display engine
Copyright Steve Grubb
|