View source: R/utilities-background.R
setWatermark | R Documentation |
Set the watermark of a ggplot
object.
Unlike addWatermark
, the watermark layer is overridden by setWatermark
.
setWatermark(
plotObject,
watermark = NULL,
color = NULL,
size = NULL,
angle = NULL,
alpha = NULL
)
plotObject |
A |
watermark |
A character value or a |
color |
Color of the watermark. |
size |
Size of the watermark. |
angle |
Angle of the watermark (in degree). |
alpha |
Numeric value between 0 and 1 corresponding to transparency of the watermark The closer to 0, the more transparent the watermark is. The closer to 1, the more opaque the watermark is. |
A ggplot
object
# Add a watermark to an empty plot
p <- initializePlot()
setWatermark(p, "watermark")
# Watermark with font properties
watermarkLabel <- Label$new(text = "watermark", color = "blue")
setWatermark(p, watermarkLabel)
# Horizontal watermark
setWatermark(p, watermarkLabel, angle = 0)
# Watermark totally opaque
setWatermark(p, watermarkLabel, alpha = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.