Display Attributes documents the attribute settings that you can specify for
the lines, data markers, text, or area fills in a plot. For grouped
data (when you use the GROUP= option on a plot statement), each distinct
group value can be represented in the graph by a different combination
of line pattern, color, and marker symbol (depending on the graph
type). The defaults for these features are set by the LineStyle, Color,
ContrastColor, and MarkerSymbol attributes of the GraphData1 - GraphDataN
style elements.
For grouped
plots, the style in effect and the plot settings determine which line
patterns, area fills, and plot symbols are used. If different line
patterns, colors, and/or marker symbols are used to represent group
values, then the style determines the sequences or each that are used
for the group values (as discussed in
Cycling Through Group Attributes in Overlaid Plots, other plot
settings might also influence the sequence). The sequence is repeated
as many times as needed to provide a line pattern, color, and/or marker
symbol for each group value.
You can
use attribute options on the plot statement to change the default
display attributes used for group data. For example, in the following
template definition, the LINEPARM statement’s LINEATTRS= option
specifies PATTERN=DASH. This explicit setting overrides the default
line rotation for the plot lines and uses dashed lines for all of
the plots, leaving color to distinguish among group values.
proc template;
define statgraph dashedline;
begingraph;
layout overlay;
scatterplot y=height x=weight / group=gender;
lineparm yintercept=intercept slope=slope / group=gender
lineattrs=(pattern=dash);
endlayout;
endgraph;
end;
Rather
than setting the same line pattern on all group values, you can change
the default sequence of line patterns that is used for grouped values.
To do so, set the LineStyle attribute in each of the style elements
GraphData1 through GraphDataN.
In the following example, a style
is defined to change the default line pattern for the first two lines
in the pattern sequence. The style is derived from the DEFAULT style
(the default style for the ODS HTML destination). Values are set for
the LineStyle attributes in the GraphData1 and GraphData2 style elements.
The first default line in the sequence has long dashes (style value
6) and the second line has short dashes (style value 4). The LineStyle
settings for the remaining GraphData elements are not set and so are
derived from the parent style (DEFAULT). This new line sequence is
used as the default line sequence for any plot that uses the MyDefault
style.
proc template;
define style Styles.MyDefault;
parent=Styles.Default;
style GraphData1 /
LineStyle=6;
style GraphData2 /
LineStyle=4;
end;
define statgraph testPattern;
begingraph;
layout overlay;
scatterplot y=height x=weight / group=gender;
lineparm yintercept=intercept slope=slope / group=gender
lineattrs=(pattern=MyDefault);
endlayout;
endgraph;
end;
Similarly
for grouped data, you can set the MarkerSymbol attribute in each of
the style elements GraphData1 through GraphDataN. In the following
example, a style is defined to change the default sequence that is
used for the first three marker symbols in grouped plots. Values are
set for the MarkerSymbol attributes in the GraphData1 through GraphData3
style elements. This new sequence is used as the default marker symbol
sequence for any plot that uses the MyDefault style.
proc template;
define style Styles.MyDefault;
parent=Styles.Default;
style GraphData1 /
MarkerSymbol=DIAMOND;
style GraphData2 /
MarkerSymbol=CROSS;
style GraphData3 /
MarkerSymbol=CIRCLE;
end;
define statgraph testSymbols;
begingraph;
layout Overlay;
scatterPlot y=height x=weight / group=age
markerattrs=(symbol=MyDefault);
endlayout;
endgraph;
end;