This function gets or sets the color palette of a sequence object, that is, the list of colors used to represent the states.
a state sequence object as defined by the
a vector containing the colors, of length equal to the number of states in the alphabet. The colors can be passed as character strings representing color names such as returned by the
In the plot functions provided for visualizing sequence objects, a different color is associated to each state of the alphabet. The color palette is defined when creating the sequence object, either automatically using the
brewer.pal function of the
RColorBrewer package or by specifying a user defined color vector. The
cpal function can be used to get or set the color palette of a previously defined sequence object.
cpal(seqdata)' a vector containing the colors.
cpal(seqdata) <-' the updated sequence object.
1 2 3 4 5 6 7 8 9 10 11 12 13
## Creating a sequence object with the columns 13 to 24 ## in the 'actcal' example data set ## The color palette is automatically set data(actcal) actcal.seq <- seqdef(actcal,13:24) ## Retrieving the color palette cpal(actcal.seq) seqiplot(actcal.seq) ## Setting a user defined color palette cpal(actcal.seq) <- c("blue","red", "green", "yellow") seqiplot(actcal.seq)
TraMineR stable version 2.0-6 (Built: "Mon,) Website: http://traminer.unige.ch Please type 'citation("TraMineR")' for citation information. [>] 4 distinct states appear in the data: 1 = A 2 = B 3 = C 4 = D [>] state coding: [alphabet] [label] [long label] 1 A A A 2 B B B 3 C C C 4 D D D [>] 2000 sequences in the data set [>] min/max sequence length: 12/12  "#7FC97F" "#BEAED4" "#FDC086" "#FFFF99"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.