Learn R Programming

stylo (version 0.5.7)

assign.plot.colors: Assign colors to samples

Description

Function that assigns unique colors to each class represented in a corpus: used for graph auto-coloring.

Usage

assign.plot.colors(labels, col = "colors")

Arguments

labels
a vector containing the names of the samples in a corpus; it is obligatory to use an underscore as a class delimiter. Consider the following examples: c("Sterne_Tristram", "Sterne_Sentimental", "Fielding_Tom", ...), where the classes are the authors' na
col
an optional argument specifying the color palette to be used: "colors" for full-color output (default), "greyscale" for greyscale (useful for preparing publishable pictures), and "black", if no colors should be used.

Value

  • The function returns a vector of colors, using their conventional names (e.g. red, maroon4, mediumturquoise, gold4, deepskyblue, ...), or numeric values if the greyscale option was chosen (e.g. #000000}, \code{#000000}, \code{#595959}, #B2B2B2}, ...). [object Object] # in this example, three discrete classes are specified, # for Tacitus, Caesar, and Livius sample.names = c("Tacitus_Annales","Tacitus_Germania","Tacitus_Histories", "Caesar_Civil_wars","Caesar_Gallic_wars", "Livius_Ab_Urbe_Condita") assign.plot.colors(sample.names)

    # as above, but using greyscale: assign.plot.colors(sample.names, col = "greyscale")

Details

Function for graph auto-coloring; depending on the user's choice it assigns either colors or greyscale tones to matching strings of characters which stand for class identifiers. These metadata will typically be encoded in the texts' filenames. (As class delimiter, the underscore character should be used). Alternatively, all labels can be plotted in black.