l_glyph_add_image: Add an image glyphs

View source: R/l_glyph_image.R

l_glyph_add_imageR Documentation

Add an image glyphs

Description

Image glyphs are useful to show pictures or other sophisticated compound glyphs. Note that images in the Tk canvas support transparancy.

Usage

l_glyph_add_image(widget, images, label = "", ...)

Arguments

widget

widget path as a string or as an object handle

images

Tk image references, see the l_image_import_array and l_image_import_files helper functions.

label

label of a glyph (currently shown only in the glyph inspector)

...

state arguments

Details

For more information run: l_help("learn_R_display_plot.html#images")

See Also

l_glyph_add, l_image_import_array, l_image_import_files, l_make_glyphs

Other glyph functions: l_glyph_add.default(), l_glyph_add_pointrange(), l_glyph_add_polygon(), l_glyph_add_serialaxes(), l_glyph_add_text(), l_glyph_add(), l_glyph_delete(), l_glyph_getLabel(), l_glyph_getType(), l_glyph_ids(), l_glyph_relabel(), l_primitiveGlyphs()

Examples

if(interactive()){

p <- with(olive, l_plot(palmitic ~ stearic, color = Region))
img_paths <- list.files(file.path(find.package(package = 'loon'), "images"), full.names = TRUE)
imgs <- setNames(l_image_import_files(img_paths),
                 tools::file_path_sans_ext(basename(img_paths)))
i <- pmatch(gsub("^[[:alpha:]]+-","", olive$Area), names(imgs), duplicates.ok = TRUE)

g <- l_glyph_add_image(p, imgs[i], label="Flags")
p['glyph'] <- g
}


loon documentation built on July 9, 2023, 5:48 p.m.