gl.select.shapes: Selects shapes from the base R shape palette and outputs as a...

View source: R/gl.select.shapes.r

gl.select.shapesR Documentation

Selects shapes from the base R shape palette and outputs as a vector

Description

This script draws upon the standard R shape palette to extract a vector of shapes for plotting, where the script that follows has a shape parameter expecting a vector of shapes.

Usage

gl.select.shapes(x = NULL, select = NULL, plot.display = TRUE, verbose = NULL)

Arguments

x

Optionally, provide a gl object from which to determine the number of populations [default NULL].

select

Select the shapes to retain in the output vector [default NULL, all shapes shown and returned].

plot.display

If TRUE, the shape palette is displayed in the graphics window [default TRUE; display is suppressed when verbose is 0].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity].

Details

By default the shape palette will be displayed in full in the graphics window from which shapes can be selected in a subsequent run, and the vector of shapes returned for later use. The select parameter can be used to select shapes from the specified 26 shapes available (0-25). For example, select=c(1,1,3) will select shape 1, 1 again and 3 to retain in the final vector. This can be useful for fine-tuning shape selection, and matching colors and shapes. If a gl object is provided, the number of specified shapes must agree with the number of populations; if select is not specified, one shape is assigned per population. The palette is displayed only when plot.display=TRUE (the default) and verbose >= 1.

Value

A vector with the required number of shapes

Author(s)

Author(s): Arthur Georges. Custodian: Arthur Georges – Post to https://groups.google.com/d/forum/dartr

See Also

gl.select.colors

Other graphics: gl.colors(), gl.map.interactive(), gl.plot.heatmap(), gl.plot.snp.density(), gl.select.colors(), gl.smearplot(), gl.tree.nj()

Examples

# SET UP DATASET
if (isTRUE(getOption("dartR_fbm"))) testset.gl <- gl.gen2fbm(testset.gl)
gl <- testset.gl
levels(pop(gl))<-c(rep('Coast',5),rep('Cooper',3),rep('Coast',5),
rep('MDB',8),rep('Coast',7),'Em.subglobosa','Em.victoriae')
# EXAMPLES
shapes <- gl.select.shapes() # Select and display available shapes
# Select and display a restricted set of shapes
shapes <- gl.select.shapes(select=c(1,1,1,5,8))
 # Select set of shapes and check with no. of pops.
shapes <- gl.select.shapes(x=gl,select=c(1,1,1,5,8))

dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.