new_region: Create a new plotting region contained in the background...

View source: R/new_region.R

new_regionR Documentation

Create a new plotting region contained in the background region

Description

Locate a new plotting region within the background region, set its units relative to the background region, set its min and max x and y values, put a pad between the edges of the region and available area for plotting, and apply fill and line looks.

Usage

new_region(
  pj,
  xmax,
  xmin,
  ymax,
  ymin,
  le = NA,
  be = NA,
  re = NA,
  te = NA,
  w = NA,
  h = NA,
  fc = "white",
  fa = 0.5,
  lc = "black",
  la = 0.5,
  lt = "-",
  lw = 1,
  name = "."
)

Arguments

pj

an object of class 'pj'.

xmax

a numeric scalar giving the maximum x-value for plotting objects in the region.

xmin

a numeric scalar giving the minimum x-value for plotting objects in the region.

ymax

a numeric scalar giving the maximum y-value for plotting objects in the region.

ymin

a numeric scalar giving the minimum y-value for plotting objects in the region.

le

NA or a numeric scalar locating the left edge of the region either in x units of the background region or as a proportion of the distance from the left to right edge of the area of the background region available for plotting.

be

NA or a numeric scalar locating the bottom edge of the region either in y units of the background region or as a proportion of the distance from the bottom to top edge of the area of the background region available for plotting.

re

NA or a numeric scalar locating the right edge of the region either in x units of the background region or as a proportion of the distance from the left to right edge of the area of the background region available for plotting.

te

NA or a numeric scalar locating the top edge of the region either in y units of the background region or as a proportion of the distance from the bottom to top edge of the area of the background region available for plotting.

w

NA or a positive numeric scalars giving the width of the region either in x-units of the background region or as a proportion of the width of the background region that is available for plotting.

h

NA or a positive numeric scalars giving the height of the region either in x-units of the background region or as a proportion of the height of the background region that is available for plotting.

fc

NA or a character scalar region fill color value.

fa

NA or a proportion scalars (i.e., between 0 and 1, inclusive) indicating the alpha opacity level of the region fill color.

lc

NA or a character scalar region line color value.

la

NA or a proportion scalars (i.e., between 0 and 1, inclusive) indicating the alpha opacity level of the region line color.

lt

NA or a character scalar giving line type. Valid values are c("-", ":", "=", ":=", "L=", "2="). See the lt argument section.

lw

NA or a positive numeric scalar line width indicating a multiple of the default line width (i.e., default = 1).

name

character scalar name for the new region. The special value '.' indicates that the pj package should create a name for the new region.

pad

proportion vector of length 1, 2, or 4 (see the edge padding section) with value no larger than 0.25.

Value

pj with the addition of the specified region.

The lt argument

The lt argument can take on the following values to indicate the following line types:

VALUE LINE TYPE
'-' solid
':' dotted
'=' dashed
':=' dot-dashed
'L=' long-dashed
'2=' double-width dashed

Edge padding

Edge padding can be achieved in three ways using the pad argument as shown in the following table:

edge pad = ppad = c(px, py) pad = c(pl, pr, pb, pt)
left p \* min(w, h)px \* wpl \* w
right p \* min(w, h)px \* wpr \* w
bottomp \* min(w, h)py \* hpb \* h
top p \* min(w, h)py \* hpt \* h

j-martineau/pj documentation built on March 19, 2022, 5:32 a.m.