setPage: Graphics Page

View source: R/setPage.R

setGDR Documentation

Graphics Page

Description

Sets up a graphics page. The functions setPage, setRStudio, and setGD set up onscreen devices. The functions setPDF, setSweave, setKnitr, and setPNG set up files for graphics output.

Usage

setGD(name = "USGS")

setKnitr(name, width, height, ...)

setPDF(layout = "portrait", basename = "USGS", multiplefiles = FALSE)

setPNG(name, width, height, ...)

setPage(layout = "portrait", font = "preview", name = "USGS",
  multiple = FALSE, device = "default")

setRStudio()

setSweave(name, width, height, ...)

Arguments

name

the name of the graphics page or the filename for setSweave.

width

the width of the graphics page.

height

the height of the graphics page.

...

additional arguments, which are ignored by setSweave, setKnitr, and setPNG.

layout

A description of the orientation and shape of the graphics page. See Details.

basename

the base name of the pdf file name.

multiplefiles

logical, if TRUE, then modify basename to create multiple files for multiple pages.

font

a description of the font. The choices are "preview," which is 12 point Arial Narrow; "USGS," which is 8 point Arial Narrow; "EST," which is 8 point Times New Roman; "PPT," which is 24 point Arial; and "PDF," which is 8 point Arial Helvetica-Narrow. "PDF" should be chosen if the graphs are to be saved to a portable document format (pdf) file.

multiple

logical, if TRUE, then allow multiple pages.

device

the name of the graphics device. See Details.

Details

If layout is "portrait," then the page size is 8.5 by 11 inches and the graph area is 7.25 by 9.5 inches.

If layout is "landscape," then the page size is 11 by 8.5 inches and the graph area is 9.5 by 7.25 inches.

If layout is "square," then the page size is 7 by 7 inches and the graph area is 6.5 by 6.5 inches (setPage only).

If layout is "slide," then the page size is 10 by 7.5 inches and the graph area is 9.5 by 7.0 inches (setPage only).

Layout may also be a tagged list, with components width and height giving the width and height of the page, the width and height of the graph area is 0.5 inch less that the page, except for setPDF where it is 0.1 inch less.

The user may specify a graphics device other than the default for the system. This may be necessary when running under certain user environments like RStudio (TM).

Value

For setPage and setPDF, a list with two components: dev, the device number; and name, the name or basename. For setGD setSweave, setKnitr, setPNG, and setRStudio nothing is returned.

Note

The focus of all of the graphics functions is on producing near-publication ready figures for U.S. Geological Survey (USGS) report series. The function setPDF should be used to create the PDF files for those figures. The fonts that are used in graphs created by calling setPDF closely mimic those required in USGS reports. One peculiarity of the fonts is that bold expressions do not appear bold in the PDF, but the font is tagged bold.

The functions setSweave, setKnitr, and setPNG are graphics set up functions to be used when using Sweave, knitr and markdown, respectively. The functions setSweave and setPDF require a call to dev.off to close the graphics device after all graphics are completed; knitr and markdown automatically close the graphics device, so the call to dev.off is not needed in those scripts.

The function setRStudio is designed to set up the default graphics device in RStudio rather than open a separate graphics screen. This is useful for preview only as some features of the graphics system cannot be replicated on that graphics device.

The function setGD is designed to be a quick and easy graphics page setup function. It is designed to be used by functions to set up the graphics environment if the user fails to do so.

See Also

setLayout, setGraph

Examples

## Not run: 
# See for examples of setGD:
demo(topic="AnnualFlowBarChart", package="smwrGraphs")
demo(topic="Coplot-complexScatterPlot", package="smwrGraphs")
demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs")
demo(topic="DurationHydrograph", package="smwrGraphs")
demo(topic="FlowDur-Measurements", package="smwrGraphs")
demo(topic="HydroPrecip", package="smwrGraphs")
# See for examples of setPage:
demo(topic="PiperScript", package="smwrGraphs")
# See for examples of setPDF:
demo(topic="MeasurementRating", package="smwrGraphs")
demo(topic="PiperScript", package="smwrGraphs")
demo(topic="RightAxisExample", package="smwrGraphs")
demo(topic="TopAxisExample", package="smwrGraphs")
# See for examples of setSweave:
vignette(topic="BoxPlots", package="smwrGraphs")
vignette(topic="DateAxisFormats", package="smwrGraphs")
vignette(topic="GraphAdditions", package="smwrGraphs")
vignette(topic="GraphGallery", package="smwrGraphs")
vignette(topic="GraphSetup", package="smwrGraphs")
vignette(topic="LineScatter", package="smwrGraphs")
vignette(topic="PiperPlot", package="smwrGraphs")
vignette(topic="ProbabilityPlots", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.