numero.plot: Plot results from SOM analysis

View source: R/numero.plot.R

numero.plotR Documentation

Plot results from SOM analysis

Description

Plot map colorings and save them as vector graphics

Usage

numero.plot(results, variables = NULL, topology = NULL, folder = NULL,
            prefix = "figure", reference = NULL, subplot = NULL,
	    gain = 1, detach = FALSE, capacity = 500, font = NULL)

Arguments

results

A list object that contains the self-organizing map and its statistical colorings.

variables

A string vector that contains names of variables to show.

topology

The topology of a SOM with subgroup labels.

folder

Folder path for saving figures.

prefix

Prefix for each figure file (if saving enabled).

reference

Reference color ranges and scales.

gain

Modifier for overall color intensity.

subplot

A two-element vector that sets out the number of rows and columns for subplots per figure.

detach

Use detached windows for figures.

capacity

Maximum number of subplots to show on screen.

font

Multiplier to adjust font size for SVG and HTML output, see nroPlot.save().

Details

The input results must contain the output from codenumero.evaluate() or similar.

The input argument topology can be the topology of a SOM or with additional columns as in the output from numero.subgroup().

The input argument reference follows the output format from numero.evaluate().

Possible values for detach include "X11", "aqua", TRUE or FALSE. Using multiple figures may result in different behaviour in terminal vs. RStudio instances. The default behaviour is to create detached windows for each figure when the X11 display server is available (e.g. in Linux). To use detached windows in Mac, use the value "aqua". Setting detach = TRUE will use a more general approach, however, some systems may behave unpredictably. To create multiple figures that remain docked within the RStudio work window, set detach = FALSE.

If a destination folder is provided, all plots are saved in files without plotting them on screen.

Value

The number of figures that were created.

Author(s)

Ville-Petteri Makinen

Examples

# Import data.
fname <- system.file("extdata", "finndiane.txt", package = "Numero")
dataset <- read.delim(file = fname)

# Set identities and manage missing data.
dataset <- numero.clean(dataset, identity = "INDEX")

# Prepare training variables.
trvars <- c("CHOL", "HDL2C", "TG", "CREAT", "uALB")
trdata <- numero.prepare(data = dataset, variables = trvars,
    batch = "MALE", confounders = c("AGE", "T1D_DURAT"))

# Create a self-organizing map.
sm <- numero.create(data = trdata)
qc <- numero.quality(model = sm)

# Evaluate map statistics for all variables.
stats <- numero.evaluate(model = qc, data = dataset)

# Plot map colorings.
numero.plot(results = stats)

Numero documentation built on Jan. 9, 2023, 9:08 a.m.

Related to numero.plot in Numero...