stamp_png: Stamp a png image

View source: R/stamp_png.R

stamp_pngR Documentation

Stamp a png image

Description

Stamp a png image

Usage

stamp_png(
  x0 = 0,
  y0 = 0,
  png = system.file("img", "Rlogo.png", package = "png"),
  image = png::readPNG(png),
  width = 1,
  height = width * dim(image)[1]/dim(image)[2],
  show.legend = F,
  alpha = 1,
  x0y0 = NULL,
  reduce = 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

image

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

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

Examples

# stamp in plotspace
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_png()

# tiling pngs needs work
ggcanvas() +
  stamp_png(x0y0 = pos_wrap_png(),
  alpha = .75)

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