stamp_png2: Stamp a png image

View source: R/stamp_png2.R

stamp_png2R Documentation

Stamp a png image

Description

Stamp a png image

Usage

stamp_png2(
  x0 = 0,
  y0 = 0,
  png = system.file("img", "Rlogo.png", package = "png"),
  color = "black",
  width = 1,
  height = width * dim(image)[1]/dim(image)[2],
  show.legend = F,
  alpha = 1,
  x0y0 = NULL
)

Arguments

x0

numeric x center of shape, defaults to 0

y0

numeric y center of shape, defaults to 0

png

a string with the path to an image, defaults to R image

color

a character string indicating color, defaults to "black", for other named colors check out https://evamaerey.github.io/ggplot2_grammar_guide/named_colors

width

the width that the image should fill, defaults to 1

height

the height that the image should fill, calculated to match aspect ratio based on width

alpha

numeric between 0 and 1 indicating transparency, defaults to 1 fully opaque, zero is fully transparent

x0y0

dataframe indicating center of shapes, where first column is vector for x values and second column is vector for y values, defaults to NULL

image

a numeric array with png red green blue alpha information, defaults to png::readPNG(png)

Examples

# stamp in plot space
library(ggplot2)
ggplot(cars, aes(dist, speed)) +
  geom_point() +
  stamp_png(x0 = 5:11*10, y0 = 10,
            height = 1, width = 10)

# two stamps
ggcanvas() +
  stamp_png() +
  stamp_png(x0 = 2:3, y0 = 6,
            width = .95)

# png spokes
ggcanvas() +
  stamp_png2()

# tiling pngs needs work
ggdraft() +
  stamp_png2(alpha = .75, x0 = .5)

EvaMaeRey/ggstamp documentation built on June 30, 2022, 11 p.m.