8 legend options — Options for specifying legends
Note our use of subtitle() and not title(); title()s are nearly always too big. See
[G-3] title options.
region(roptions) specifies the border and shading of the legend. You could remove the border around
the legend by specifying legend(region(lstyle(none))) (thus doing away with the line) or
legend(region(lcolor(none))) (thus making the line invisible). You could also give the
legend a gray background tint by specifying legend(region(fcolor(gs5))). See Suboptions
for use with legend(region( )) below.
Suboptions for use with legend(region( ))
style(areastyle) specifies the overall style of the region in which the legend appears. The other
suboptions allow you to change the region’s attributes individually, but style() provides the
starting point. See [G-4] areastyle for a list of choices.
color(colorstyle) specifies the color and opacity of the background of the legend and the line used
to outline it. See [G-4] colorstyle for a list of color choices.
fcolor(colorstyle) specifies the background (fill) color and opacity for the legend. See [G-4] colorstyle
for a list of color choices.
lstyle(linestyle) specifies the overall style of the line used to outline the legend, which includes its
pattern (solid, dashed, etc.), its thickness, and its color. The other suboptions listed below allow you
to change the line’s attributes individually, but lstyle() is the starting point. See [G-4] linestyle
for a list of choices.
lcolor(colorstyle) specifies the color and opacity of the line used to outline the legend. See
[G-4] colorstyle for a list of color choices.
lwidth(linewidthstyle) specifies the thickness of the line used to outline the legend. See
[G-4] linewidthstyle for a list of choices.
lpattern(linepatternstyle) specifies whether the line used to outline the legend is solid, dashed, etc.
See [G-4] linepatternstyle for a list of choices. When lpattern() is specified, the line alignment
is always center; thus, lalign() is ignored.
lalign(linealignmentstyle) specifies whether the line used to outline the area is inside, outside, or
centered. See [G-4] linealignmentstyle for a list of alignment choices.
margin(marginstyle) specifies the inner margin between the border and the contents of the legend.
Also see bmargin() under Content suboptions for use with legend( ) and plegend( ) above for
specifying the outer margin around the legend. See [G-4] marginstyle for a list of margin choices.
Location suboptions for use with legend( )
off and on determine whether the legend appears. The default is on when more than one symbol
(meaning marker, line style, or color swatch) appears in the legend. In those cases, legend(off)
will suppress the display of the legend.
position(clockposstyle), ring(ringposstyle), and bplacement(compassdirstyle) override the de-
fault location of the legend, which is to the right of the plot region for the default scheme, stcolor.
position() specifies a direction [sic] according to the hours on the dial of a 12-hour clock, and
ring() specifies the distance from the plot region.
ring(0) is defined as being inside the plot region itself and allows you to place the legend inside
the plot. ring(k), k > 0, specifies positions outside the plot region; the larger the ring() value,
the farther away from the plot region the legend is. ring() values may be integers or nonintegers
and are treated ordinally.