ggmorph_radial: Display morphs radially within a morphological space

View source: R/ggmorph.R

ggmorph_radialR Documentation

Display morphs radially within a morphological space

Description

Display morphs radially within a morphological space

Usage

ggmorph_radial(
  space,
  imgs,
  dimensions = c(1, 2),
  directions = 4,
  steps = 2,
  n_imgs = 5,
  adjust_grey = TRUE,
  scale = 0.01,
  fun = NULL,
  ...
)

Arguments

space

morphological space object created by morphospace().

imgs

vector of paths to images; should have as many elements as are in the morphological space

dimensions

couple of dimensions to plot.

directions

number of radial directions along which to display morphs.

steps

number of steps in each direction at which to display a morph (a morph is always displayed in the middle of the space).

n_imgs

number of images to randomly select and morph in each tile.

adjust_grey

whether to adjust the mean grey level of the morphed image to match that of the original images it was constructed with. Usually, computing the average (i.e. the morphing) results in lighter images; this compensates it a little. Note that it requires more intense computation and is therefore switched off by default.

scale

scaling factor used to display the images; from pixels to morphological space dimensions units.

fun

function to apply to each image, as a pre-processing step (a typical one is img_chop() to remove a scale bar added to the image).

...

passed to fun.

Examples

space <- morphospace(plank[,-(1:2)], weights=plank$conc)
img_root <- system.file("extdata", "plank", package="morphr")
imgs <- file.path(img_root, paste0(plank$id, ".jpg"))
set.seed(1)
ggmorph_radial(space, imgs)
ggmorph_radial(space, imgs, directions=10, steps=4, scale=0.005)
ggmorph_radial(space, imgs, dim=c(3,4), scale=0.004)

jiho/morphr documentation built on May 11, 2024, 9:32 p.m.