Skip to contents

Label image using magick::image_annotate. All arguments are vectorised over the stimuli and values are recycled or truncated if there are fewer or more than stimuli. Setting a font, weight, style only works if your imagemagick is compiled with fontconfig support.

Usage

mlabel(
  stimuli,
  text = TRUE,
  gravity = "north",
  location = "+0+0",
  degrees = 0,
  size = 0.1,
  font = "sans",
  style = "normal",
  weight = 400,
  kerning = 0,
  decoration = NULL,
  color = "black",
  strokecolor = NULL,
  boxcolor = NULL
)

Arguments

stimuli

list of stimuli

text

a vector of the label text(s) or TRUE to use stimlist names

gravity

string with gravity value from magick::gravity_types.

location

geometry string with location relative to gravity

degrees

rotates text around center point

size

font size in pixels or proportion of image width (if < 1.0)

font

string with font family such as "sans", "mono", "serif", "Times", "Helvetica", "Trebuchet", "Georgia", "Palatino" or "Comic Sans".

style

value of magick::style_types(): "Undefined", "Any", "Italic", "Normal", "Oblique"

weight

thickness of th e font, 400 is normal and 700 is bold.

kerning

increases or decreases whitespace between letters

decoration

value of magick::decoration_types(): "LineThrough" "None", "Overline", "Underline"

color

a vector of the label colour(s)

strokecolor

adds a stroke (border around the text)

boxcolor

adds a background color

Value

stimlist with labelled images

See also

gglabel() for a labeller using syntax like ggplot2::annotate()

Visualisation functions as_ggplot(), draw_tem(), gglabel(), label(), plot.stimlist(), plot.stim(), plot_rows(), plot_stim()

Examples

stimuli <- demo_stim()
mlabel(stimuli,
       text = c("CHINWE", "GEORGE"), 
       gravity = c("north", "south"),
       color = "red")