watermark: Add a watermark to an existing plot

Description Usage Arguments Examples

View source: R/watermark.R

Description

This function should be run following a plot. It will add a transparent text label to act as a watermark.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
watermark(
  text,
  location = NULL,
  x = NULL,
  y = NULL,
  col = "black",
  alpha = 0.5,
  srt = 45,
  cex = 1,
  ...
)

Arguments

text

a character vector specifying the text to be written

location

an optional character vector specifying the location for the text to be plotted

x

optional x co-ordinate to be used to position the text

y

optional y co-ordinate to be used to position the text

col

the colour of the text to be plotted. Defaults to black.

alpha

the transparency (0=translucent and 1=opaque) of the text to be plotted. Defaults to 0.5.

srt

the number of degrees from horizontal to set the angle of the text

cex

numeric character expansion factor. By default, text will be stretched to fit plotting window.

...

additional arguments to be passed to the text() function

Examples

1
2
3
4
5
6
7
8
9
# Generate some example data
x <- runif(10000)
y <- runif(10000)

# Plot the points
plot(x, y, las=1, bty="n", pch=19, col=rgb(0,0,0, 0.1))

# Add a watermark
watermark("CONFIDENTIAL", col="red")

JosephCrispell/plotteR documentation built on June 6, 2021, 7:24 p.m.