plframe: Low level plotting functions for the 'pl' system

plframeR Documentation

Low level plotting functions for the 'pl' system

Description

These functions set up the frame of a plot based on the 'pl' paradigm

Usage

plframe(x = NULL, y = NULL, xlab = NULL, ylab = NULL,
  xlim = NULL, ylim = NULL, mar = NULL, showlabels = TRUE, 
  plext = NULL, axcol = rep(1, 4), 
  plargs = NULL, ploptions = NULL, marpar = NULL, xy = NULL, ...)

pltitle(main=NULL, sub=NULL, csize=NULL, csizemin=NULL, 
  side=3, line=NULL, adj=NULL, outer.margin=NULL, col="black",
  doc=NULL, show=NA, plargs=NULL, ploptions = NULL, marpar = NULL, ...)

plaxis(side, x=NULL, showlabels=TRUE, range=NULL, varlabel=NULL, col=1,
  tickintervals=NULL,
  plargs = NULL, ploptions = NULL, marpar = NULL, ...) 

Arguments

x

coordinates for the horizontal axis

y

coordinates for the vertical axis

xlab, ylab

axis labels

xlim, ylim

plot ranges

mar

plot margins

showlabels

logical: should labels for tickmarks and the variable label be displayed? If ==1, they are shown if there is enough space in the margin (including outer margin), if ==2, it is shown anyway (by setting xpd=TRUE).

plext

extension of the plotting area beyond the range of the data.

axcol

colors for drawing axes scales

main, sub

main title and subtitle

varlabel

variable name

side

For pltitle: in which margin should the text be shown?
For plaxis: integer indicating which axis is to be drawn

csize

character size. May be vector of length 3, giving size for main title, subtitle, and tit attribute of title, respectively. The default is given by ploptions("title.cex").

csizemin

minimal character size, to be used to adjust the character size to the length of the text (if cex is NULL)

line

line in margin on which the main title is placed – or the subtitle if main is NULL

adj

text adjustment, scalar between 0 and 1

outer.margin

logical: should title text be placed in outer margin?

col

color for the title text or axis line and tickmarks

range

range in which tickmarks are set

doc

logical: should the tit attribute of main be displayed if available?

show

logical: if FALSE, nothing will be done if there are multiple frames and the current one is not the first. If it is negative, no title will be shown, but the value will be returned.

tickintervals

number of intervals used by pretty to determine the axis ticks.

plargs, ploptions

result of pl.control, see Details

marpar

margin parameters, if already available. By default, they will be retieved from ploptions.

xy

logical: should the coordinates be obtained as in high level graphics? This is set to FALSE to save time and avoid complications, in case the user is sure that x and y are vectors rather than formulas or variable names.

...

absorbs extra arguments

Details

If the arguments x and y are not given, they are obtained from pl.envir$pldata.

plframe draws axes according to argument axes, by calling plaxis. It looks for attributes of x and y, such as innerrange and ticksat. Tick labels are shown at the values of the ticklabelsat attribute if available, otherwise at the values of ticksat. The labels can be given by the attribute ticklabels. This facilitates setting more tick marks than labels, see the example.
It also draws a grid. The positions of gridlines at ticksat by default.
Finally, it draws "zero" lines as determined by the pl option zeroline. The latter can be a numeric vector giving the positions of such threshold lines, or a list of two such vectors, the first for horizontal axis, the second for the vertical axis.

plaxis only shows the variable label, tick labels and tickmarks if there is enough space or showlabels > 1. If it is called when there are multiple panels, this is decided according to the actual mar setting if it is an inner panel; if it is a panel adjacent to an outer margin, then the oma setting is also used.

plargs and ploptions may be specified explicitly, but they are usually generated by calling pl.control.

Value

plframe and plaxis invisibly return the former par(c("cex", "mar", "mgp")) if setpar is TRUE, otherwise NULL.

pltitle invisibly return a list consisting of the main and sub title.

Author(s)

Werner A. Stahel

See Also

gendateaxis; pl.control

Examples

plyx(Sepal.Width ~ Sepal.Length, data=iris)

## again, each step separately
t.dt <- pl.envir$pldata
oldpar <- plframe() ## or plframe(t.dt$Sepal.Length, t.dt$Sepal.Width, plargs=pl.envir)
plsmooth() ## or plsmooth(t.dt$Sepal.Length, t.dt$Sepal.Width, plargs=pl.envir)
t.plab <- plmark(markextremes=0.03)
  ## or plmark(t.dt$Sepal.Length, t.dt$Sepal.Width, markextremes=0.03, plargs=pl.envir)
plpoints(plab=t.plab) ## or plpoints(t.dt$Sepal.Length, t.dt$Sepal.Width,
                      ##      plargs=pl.envir, plab=t.plab)
plaxis(4)

par(oldpar)   ## reset the changed graphical parameters

plgraphics documentation built on Oct. 19, 2023, 3 p.m.