This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/par.html
par {base}R Documentation

Set or Query Graphical Parameters

Description

par can be used to set or query graphical parameters. Parameters can be set by specifying them as arguments to par in tag = value form, or by passing them as a list of tagged values. In either case the previous values are returned in an invisible tagged list. Such a list can be passed as an argument to par to restore the parameter values.

Parameters are queried by giving vectors of character strings to par. In this case, the values are returned in a tagged list.

Usage

par(...)

Arguments

adj

The value of adj determines the way in which text strings are justified. A value of 0 produces right left-justified text, 0.5 centered text and 1 right-justified text.

ann

If set to FALSE, high-level plotting functions do not annotate the plots they produce with axis and overall titles. The default is to do annotation.

bg

The color to be used for the background of plots. A description of how colors are specified is given below.

bty

A character string which determined the type of box which is drawn about plots. If bty is one of "o", "l", "7" or "c" the resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box.

cex

A numerical value giving the amount by which plotting text and symbols should be scaled relative to the default.

cex.axis

The magnification to be used for axis anotation relative to the current.

cex.lab

The magnification to be used for x and y labels relative to the current.

cex.main

The magnification to be used for main titles relative to the current.

cex.sub

The magnification to be used for sub-titles relative to the current.

col

A specification for the default plotting color. A description of how colors are specified is given below.

col.axis

The color to be used for axis annotation.

col.lab

The color to be used for x and y labels.

col.main

The color to be used for plot main titles.

col.sub

The color to be used for plot sub-titles.

crt

A numerical value specifying (in degrees) how strings should be rotated. It is unwise to expect values other than multiples of 90 to work.

csi

(Unimplemented) The height of characters in inches.

err

(Unimplemented) The degree of error reporting desired.

fg

The color to be used for the foreground of plots. This is the default color is used for things like axes and boxes around plots. A description of how colors are specified is given below.

fig

A numerical vector of the form c(x1, x2, y1, y2) which gives the (NDC) coordinates of the figure region in the display region of the device.

fin

A numerical vector of the form c(x, y) which gives the size of the figure region in inches.

font

An integer which specifies which font to use for text. If possible, device drivers arrange so that 1 corresponds to plain text, 2 to bold face, 3 to italic and 4 to bold italic.

lab

A numerical vector of the form c(x, y, len) which modifies the way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes and len species the label size. Currently, len is unimplemented.

las

(Unimplemented) the style of axis labels. 0=always parallel to the axis, 1=always horizontal, 2=always perpendicular to the axis.

lty

The line type. Line types can either be specified as an integer (1=solid, 2=dashed, 3=dotted 4=dotdashed) or as one of the character strings "solid", "dashed", "dotted" or "dotdashed". Alternatively, a string of up to 8 characters may be given, giving the length (in points) of line segments which are alternatively drawn and skipped. For example, "44" is dashed and "13" is dotted.

mai

A numerical vector of the form c(xb, xt, yl, yr) which gives the margin size specified in inches.

mar

A numerical vector of the form c(xb, xt, yl, yr) which gives the lines of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1.

mex

mex is a character size expansion factor which is used to describe coordinates in the margins of plots.

mfcol

This is a vector of the form c(nr, nc). Subsequent figures will be drawn in an nr-by-nc array on the device by columns.

mfg

A numerical vector of the form c(i, j, nr, nc) where i and j indicate which figure in an nr-by-nc array of figures is currently being drawn.

mfrow

This is a vector of the form c(nr, nc). Subsequent figures will be drawn in an nr-by-nc array on the device by rows.

mgp

The margin line for the axis title, axis labels and axis line. The default is c(3, 1, 0).

mkh

The height in inches of symbols to be drawn when the value of pch is an integer.

oma

A vector of the form c(xb, xt, yl, yr) giving the size of the outer margins in lines of text.

omd

A vector of the form c(x1, x2, y1, y2) giving the NDC coordinates of the region where (multiple) figures will appear on the device.

omi

A vector of the form c(xb, xt, yl, yr) giving the size of the outer margins in inches.

pch

Either an integer specifying a symbol or a single character to be used as the default in plotting.

pin

The width and height of the current plot in inches.

plt

A vector of the form c(x1, x2, y1, y2) giving the the coordinates of the plot region as fractions of the current figure region.

pty

A character specifying the type of plot region to be used; "s" generates a square plotting region and "m" generates the maximal plotting region.

smo

(Unimplemented) a value which indicates how smooth circles and circular arc should be.

srt

The string rotation in degrees. Causes srt to be set to the same value.

tck

The length of tick marks as a fraction of the smaller of the width or height of the plotting region. If tck=1, grid lines are drawn. The default value is -0.2.

tmag

A number specifying the enlargement of text of the main title relative to the other annotating text of the plot.

usr

A vector of the form c(x1, x2, y1, y2) giving the extremes of the user coordinates of the plotting region.

xaxp

A vector of the form c(x1, x2, n) giving the coordinates of the extreme tick marks and the number of intervals between tick-marks.

xaxs

(Unimplemented) The style of axis interval calculation to be used for the x-axis.

xaxt

A character which specifies the axis type. Specifying "n" causes an axis to be set up, but not plotted.

xlog

A logical value. If TRUE a logarithmic scale is used. The default is to use a linear scale.

xpd

A logical value. If FALSE, all plotting is clipped to the plot region.

yaxp

A vector of the form c(y1, y2, n) giving the coordinates of the extreme tick marks and the number of intervals between tick-marks.

yaxs

(Unimplemented) The style of axis interval calculation to be used for the y-axis.

yaxt

A character which specifies the axis type. Specifying "n" causes an axis to be set up, but not plotted.

ylog

A logical value. If TRUE a logarithmic scale is used. The default is to use a linear scale.

Color Specification

Colors can be specified in several different ways. The simplest way is with a character string giving the color name (e.g., "red"). A list of the possible colors can be obtained with the function colors. Alternatively, colors can be specified directly in terms of there RGB components with a string of the form "#RRGGBB" where each of the pairs RR, GG, BB consist of two hexidecimal digits giving a value in the range 00 to FF. Colors can also be specified by giving an index into a small table of colors. This provides compatibility with S.

The functions rgb, hsv, gray and rainbow provide additional ways of generating colors.

Line Type Specification

Line types can either be specified by giving an index into a small built in table of line types (1=solid, 2=dashed, 3=dotted) or directly as the lengths of on/off stretches of line. This is done with a string of up to eight characters which give the lengths in consecutive positions in the string. For example, the string "33" specifies three pixels on followed by three off and "3313" specifies three pixels on followed by three off followed by one on and finally three off.

See Also

colors, gray, rainbow, rgb; options for other setup parameters; graphic devices x11, postscript.

Examples

op <- par(mfrow = c(2, 2), # 2 x 2 pictures on one plot
          pty = "s")      # square plotting region, independent of device size

## At end of plotting, reset to previous settings:
par(op)

[Package base version 0.60 ]