Learn R Programming

tis (version 1.39)

screenPage: Page Setup for Plots

Description

Places header and footer text items in outer margin of page and splits the screen appropriately. Can also redraw header and footer.

Usage

screenPage(head = NULL, sub = NULL, foot = NULL,
           date = FALSE, dateFormat = "%x", time = FALSE,
           topLeft = character(0), topRight = character(0),
           headFont = par("font.main"), subFont = par("font.sub"),
           footFont = par("font"),
           cex = 1.001, headCex = 1.5, subCex = 0.85,
           footCex = 0.75, topLeftCex = 0.85, topRightCex = 0.85,
           footAlign = 0,
           leftMargin = 0, rightMargin = leftMargin,
           topMargin = 0, bottomMargin = topMargin)

Arguments

head

character string or strings to appear centered in the top outer margin of the page. If length(head) > 1, a multi-line main title results.

sub

character string or strings to appear centered just under head.

foot

character string or strings to appear in the bottom outer margin of the page.

date

logical: if TRUE, put the current date in the upper right corner of the page.

dateFormat

strptime-style format to use if date is TRUE. The default formats dates like 11/30/2006. What is actually being formatted is the value returned by Sys.time(), so you can also use time formats here. For example, setting dateFormat = "%c" will create a string like "Thu 30 Nov 2006 02:49:45 PM EST".

time

logical: if TRUE, put the current time in the upper right corner of the page. If date is also true, the time string will be on the line below the date string.

topLeft

character string or strings to appear at top left corner of the page

topRight

character string or strings to appear at top right corner of the page

headFont

font to use in writing the main title in head. The default uses whatever par("font.main") is set to.

subFont

font to use in writing the sub title in sub. The default uses whatever par("font.sub") is set to.

footFont

font to use in writing the footnotes in foot. The default uses whatever par("font") is set to.

cex

number by which all of the other "cex" arguments are scaled.

headCex

number: Character Expansion Factor (cex) for the string(s) in head. The actual cex used will be cex * headCex.

subCex

number: cex for the string(s) in sub. The actual cex used will be cex * subCex.

footCex

number: cex for the string(s) in foot. The actual cex used will be cex * footCex.

topLeftCex

number: cex for the string(s) appearing in the top left corner of the page. The actual cex used for these strings will be cex * topLeftCex.

topRightCex

number: cex for the string(s) appearing in the top right corner of the page, including the time and date stamps. The actual cex used for these strings will be cex * topRightCex.

footAlign

number: justification for the strings in foot. 0 means left justify, 1 means right justify, 0.5 means to center the text. Other numbers are a corresponding distance between the extremes.

leftMargin

left margin of page in inches.

rightMargin

right margin of page in inches. Default is same as leftMargin

topMargin

top margin of page in inches.

bottomMargin

bottom margin of page in inches. Default is same as topMargin

Value

This function returns a list of all of its arguments, including default values for arguments that were not supplied. The return is invisible if a graphics device is active.

Details

screenPage first sets aside space for the margins specified by topMargin, bottomMargin, leftMargin and rightMargin. Then it figures out how much additional space is needed for the top and bottom outer margin text elements, places them, and then splits the screen in 3, with screen 3 being the middle part of the page. The user is then free either to further subdivide screen 3 (using split.screen()) or to use it as is.

On exit, screen 3 is the active screen.

See Also

split.screen

Examples

Run this code
# NOT RUN {
screenPage(head = "Chart 1", date = TRUE, foot = rep(" ", 4),
           cex = 0.85, headCex = 1)

## then draw charts, possibly after further subdividing the screen
# }

Run the code above in your browser using DataLab