Previous Page | Next Page

The SGPLOT Procedure

KEYLEGEND Statement


Adds a legend to the plot.
Featured in: Adding a Prediction Ellipse to a Scatter Plot, Creating Lines and Bands from Pre-Computed Data, Combining Histograms with Density Plots


Syntax

KEYLEGEND <"name-1" ... "name-n"> </ option(s)>;

option(s) can be any of the following:

ACROSS= n

BORDER | NOBORDER

DOWN= n

LOCATION= OUTSIDE | INSIDE

POSITION= position-value

TITLE= "text-string"


Optional Arguments

"name-1" ... "name-n"

specifies the names of one or more plots that you want to include in legend. Each name that you specify must correspond to a value that you entered for the NAME= option in a plot statement.

Note:   If you do not specify a name, then the legend contains references to all of the plots in the graph.  [cautionend]


Options

ACROSS= n

specifies the number of columns in the legend. By default, the number of columns is determined automatically.

Note:   Depending on the number of legend entries and the number of columns and rows that you specify, the legend might not fit in your graph. If your legend does not appear, then you might need to specify a different value for the ACROSS= option.  [cautionend]

BORDER | NOBORDER

specifies whether the border around the legend is visible. The BORDER option shows the border. The NOBORDER option hides the border.

Default: BORDER
DOWN= n

specifies the number of rows in the legend. By default, the number of rows is determined automatically.

Note:   Depending on the number of legend entries and the number of columns and rows that you specify, the legend might not fit in your graph. If your legend does not appear, then you might need to specify a different value for the DOWN= option.  [cautionend]

LOCATION= OUTSIDE | INSIDE

specifies whether the legend is placed outside or inside of the axis area. The OUTSIDE option places the legend outside of the axis area. The INSIDE option places the legend inside of the axis area.

Default: OUTSIDE
POSITION= position-value

specifies the position of the legend within the graph. The positions are as follows:

BOTTOM

places the legend at the bottom of the graph.

BOTTOMLEFT

places the legend at the bottom left corner of the graph.

BOTTOMRIGHT

places the legend at the bottom right corner of the graph.

LEFT

places the legend at the left side of the graph.

RIGHT

places the legend at the right side of the graph.

TOP

places the legend at the top of the graph.

TOPLEFT

places the legend at the top left corner of the graph.

TOPRIGHT

places the legend at the top right corner of the graph.

Note:   By default, if you use more than one KEYLEGEND statement, then each legend is placed in a different position.  [cautionend]

Note:   If you specify more than one legend with the same position, then all of your legends are placed at that position.  [cautionend]

Default: BOTTOM
TITLE= "text-string"

specifies a title for the legend.

Previous Page | Next Page | Top of Page