assignColLab {GCDkit}R Documentation

Colours by label

Description

Assigns plotting colours according to the levels of the chosen label or, alternatively, sample names.

Usage

assignColLab(lab = NULL, pal = NULL, colours = NULL, display.legend = FALSE)

Arguments

lab

specification of the variable to be used for colours assignment. See Details.

pal

character; name of the palette to be used when no colours are specified directly. Batch mode only.

colours

a vector with codes of colours to be assigned. Batch mode only.

display.legend

logical; should be the legend displayed? Batch mode only.

Details

If called from in interactive mode (from GUI), the variable (sample names or label) can be selected using the function 'selectColumnLabel'.

In batch mode, 'lab' can be an integer (1 for sample names, or a sequence number of the column in the 'labels' plus 1). Alternatively, it can contain the full name of a column in 'labels'. See examples.

If in batch mode, either 'colours' or 'palette' have to be specified for the correct colour assignment.

Value

Sets 'leg.col' to a sequence number of column in 'labels' that is to be used to build the legend or -1 if sample numbers are to be used; 'labels$Colour' contains the codes of the desired plotting colours.

Author(s)

Vojtěch Janoušek, vojtech.janousek@geology.cz

See Also

To display the current legend use showLegend. Symbols by a single label can be assigned by assignSymbLab, symbols and colours by groups simultaneously by assignSymbGroup. Uniform colours and symbols are obtained by assign1symb and assign1col. Table of available plotting symbols is displayed by showSymbols and colours by showColours.

Selecting a label: selectColumnLabel.

Selecting a palette: selectPalette.

Examples

    data(sazava)
    accessVar("sazava")
    
    ## Not run: assignColLab()    # Interactive mode
    
    # Sample names, standard GCDkit colours palette 
    assignColLab(1,colours=palette.gcdkit,display.legend=TRUE)        
    
    # Standard palettes
    assignColLab(3,pal="jet.colours",display.legend=TRUE)          # Second column in labels 
    
    assignColLab("Locality",pal="jet.colours",display.legend=TRUE) # Ditto (here Locality)

    # User defined palette
    my.palette<-colorRampPalette(c("black", "green", "red"),space = "rgb")
    assignColLab("Locality",pal="my.palette",display.legend=TRUE)

[Package GCDkit version 6.1 Index]