panel_annotation {ursa} | R Documentation |
Add label or annotation to the image panel.
Description
panel_annotation
puts an annotation (text label) on the panel with raster image without anchors to any layer. Can be used as captions to image panels.
Usage
panel_annotation(...)
# non-public
.panel_annotation(label = expression(), position = "bottomright",
lon = NA, lat = NA, x = NA, y = NA, cex = 1.0, adjust = 0.5,
fg = "#000000", bg = "#FFFFFF1F", buffer = 1, fill = "#FFFFFF7F",
font = par("family"), vertical = FALSE, alpha = 1,
interpolate = FALSE, resample = FALSE, verbose = FALSE, ...)
Arguments
... |
Set of arguments, which are recognized via their names (using regular expressions) and classes:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label |
Character, expression, or objects of classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
position |
Character keyword or numeric of length 2 in the interval [0,1]. Defines the location of scale bar. If character, then one of the "bottomleft", "bottomright", "topleft", "topright", "left", "right", "bottom", "top", or "center". If numeric then relative position on panel is defined using shift on horizontal and vertical axes from origin in the bottom-left corner. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lon |
Numeric. Longitude for center of annotation's position. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lat |
Numeric. Latitude for center of annotation's position. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
x |
Numeric. The horizontal coordinate of the annotation's position in the units of image grid. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
y |
Numeric. The vertical coordinate of the annotation's position in the units of image grid. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cex |
Positive numeric. The relative font size for annotation's label. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
adjust |
One or two values in [0, 1]. Specifies the horizontal (and optionally vertical) adjustment of the labels. See description of argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fg |
Character. Color name or code for label (texts and symbols). Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bg |
Character. Color name or code for thin buffer around label's elements. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buffer |
Numeric. The relative width of buffer around label's elements. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fill |
Character. Color name or code for circumscribed rectangle around labels. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font |
Character. Font family. Default is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vertical |
Logical or numeric. Vertical or inclined orientation of label. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
interpolate |
Logical. Passed as argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resample |
Logical or numeric. Passed as argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
alpha |
Numeric or character. Level of transparency for logos. If numeric, the either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
verbose |
Logical. Value |
Details
This function is based on function text with adding some decoration elements. For low-level plotting use layout.text function, which is equal to function text with additional control of image panels.
Since the most of character keywords of position
have relation to the boundary of image panel, such annotation is assigned as a caption for image panel. Default decoration is shadowed background rectangle, which is implemented by function rect.
If location is defined by two-dimensional vector (either relative position inside of image boundaries (pos
is numeric of length two), or pair lon
, lat
, or pair x
, y
), then such labeling is assigned as an annotation. Default decoration is thin buffer around symbols. The implementaion is via application of function function text for small diplacements around original position.
The priority of arguments (from higher to lower): 1) pair lon
, lat
, 2) pair x
, y
, 3) two-dimensional numeric of pos
, 4) character keyword of pos
. However, the default annotation is interpreted as a caption.
Value
This function returns NULL
value.
Author(s)
Nikita Platonov platonov@sevin.ru
Examples
session_grid(NULL)
## exam no.1 -- direct use
compose_open(layout=c(2,3),legend=NULL,device="cairo")
for (i in seq(6)) {
panel_new()
panel_annotation(label=LETTERS,cex=1.5)
panel_annotation(pos=c(0.7,0.2)
,label=paste("panel",paste("no.",i),sep="\n"))
if (i==1)
panel_annotation(pos="center")
}
compose_close()
## exam no.2 -- indirect use
display(pixelsize(),scale=2
,ann.label="FJL",ann.lon=52,ann.lat=80,ann.buffer=1
,ann.bg="#8F6FFF2F",ann.fill="#FFFF7F9F",ann.font="courier")