tcex: Interpolate Symbol and Text Size

Description Usage Arguments Value Author(s) See Also Examples

View source: R/animatoR-functions-knitr.R

Description

This function interpolates the symbol size between the start and end size.

Usage

1
tcex(cex0 = 1, cex1 = 1, t, when, p, area = TRUE)

Arguments

cex0

numeric vector specifying start symbol size, see par cex.

cex1

numeric vector specifying end symbol size, see par cex.

t

numeric, homotopy parameter, limited between 0 and 1. This parameter can be considered as fraction of animation duration time.

when

numeric vector. This parameter controls the times of: entrance, exit, start of movement and, end of movement.

p

numeric, homotopy power parameter. Defaults to 1.

area

logical, if TRUE (default) sizes will be treated as area. If FALSE, sizes will be considered by diameter.

Value

A numeric vector giving the amount by which plotting text and symbols should be magnified relative to the default cex value.

Author(s)

Andrej Blejec andrej.blejec@nib.si

See Also

par for setting symbol sizes (cex).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
if(interactive()){
animator('
newplot()
points(3:7,3:7,col=1:5,
pch=16,cex=tcex(0,20,t),life=0.5)
')
}
if(interactive()){
# Doubling the symbol sizes
newplot()
text(2,8,"By edge:\n cex = c(8, 16)")
points(2,5,cex=16,pch=0)
points(2-0.75*par("cin")[2]*4,
5-0.75*par("cin")[2]*4,cex=8,pch=15, col="grey")
text(8,8,"By size:\n cex = sqrt(c(4, 16, 64))")
points(8,5,cex=sqrt(64*4),pch=0)
points(8,5,cex=sqrt(16*4),pch=15, col="grey")
points(8,5,cex=sqrt(4*4),pch=0)
abline(v=c(2,8),h=5,col="red")
}

ablejec/animatoR documentation built on Feb. 21, 2020, 10:09 p.m.