Question

I am using the function seqiplot to create a sequence index plot. The problem is that I get some inconsistencies between what is shown on the plot and my sequence data. For example, I have the same sequence state in period t and t+1; however, the sequence index plot shows different colours for each period. Should not they have the same colour?

I suspect that it has to do with the number of posible states in my data set. There are 60 different states. So when I try to set the colour scheme I get this message: In brewer.pal(60, "Accent") : n too large, allowed maximum for palette Accent is 8 Returning the palette you asked for with that many colors

which indicates that Accent has a maximum of 8 colours (isn't it?).

Has anyone had a similar problem? How can I fix it?

Regards,

Francisco.

Was it helpful?

Solution

The default color palette used by TraMineR can get a maximum of 12 different colors, which is clearly insufficient in your case. Hence, you have to specify the color palette using the cpal argument in seqdef. The colorspace package provides functions to get more than 12 colors.

To choose your 60 colors using a graphical interface:

library(colorspace)
pal <- choose_palette()
seqdef(..., cpal=pal)

Or to automatically get a list of colors, try

library(colorspace)
pal <- diverge_hcl(60)
seqdef(..., cpal=pal)

See ?diverge_hcl for more options.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top