To add
cell headers to the grid, you must specify a CELL block that contains
a nested CELLHEADER block. The CELLHEADER block can contain one or
more ENTRY statements, or it can contain other statements (DISCRETELEGEND,
for example).
entrytitle "Simple 3x1 Lattice with Cell Headers";
layout lattice / columns=3 rows=1;
/* cell blocks cells 1-3 */
cell;
cellheader;
entry "Spline Fit";
endcellheader;
layout overlay;
scatterplot y=weight x=height;
pbsplineplot y=weight x=height;
endlayout;
endcell;
cell;
cellheader;
entry "Loess Fit";
endcellheader;
layout overlay;
scatterplot y=weight x=height;
loessplot y=weight x=height;
endlayout;
endcell;
cell;
cellheader;
entry "Regression Fit";
endcellheader;
layout overlay;
scatterplot y=weight x=height;
regressionplot y=weight x=height;
endlayout;
endcell;
endlayout;
You can enhance any
cell header in the following way:
-
nest a GRIDDED layout in the CELLHEADER
block
-
set BORDER=TRUE on the LAYOUT GRIDDED
statement
-
add the ENTRY statement(s) to the
GRIDDED layout.
Because
the GRIDDED layout fills the cell header space above the plot wall,
its border aligns nicely with the plot.
You can
further enhance the cell header by making the GRIDDED layout's background
opaque and setting a background color for it. To ensure that the color
remains coordinated with the current style, you could choose any of
several style elements that define light background colors, such as
GraphHeaderBackground, GraphBlock, or GraphAltBlock. Note that several
style definitions set the GraphHeaderBackground color to be the same
as the GraphBackground color. For styles like LISTING and JOURNAL,
the background is white.
As a final
enhancement, you could coordinate the text color for the cell headers
with a visual attribute in the plot. For example, if you are displaying
a fit plot in the cell, you could set the text color to match the
color of the fit line. The TEXTATTRS= option in the ENTRY statement
can be used to set the text properties. The default settings for TEXTATTRS=
are derived from the GraphValueText style element. For more information
on ENTRY statements,
see Adding and Changing Text in a Graph.
The following
code enhances the cell header block of the first cell. Similar code
would be used to enhance the header blocks of the other two cells:
cellheader;
layout gridded / border=true opaque=true
backgroundcolor=GraphAltBlock:color;
entry "Spline Fit" / textattrs=(color=GraphFit:contrastColor);
endlayout;
endcellheader;
If you
have a lengthy text description to add to a cell header, you should
use multiple ENTRY statements to break the text into small segments;
otherwise, the text might be truncated. Also, for a given row, if
the number of lines of text in the cell headers varies, a uniform
cell height is maintained across the row by setting all the row headers
to the height needed by the largest cell header.