Inconsistency between sequences and seqiplot

ⅰ亾dé卋堺 提交于 2019-12-12 21:24:17

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/19805548/inconsistency-between-sequences-and-seqiplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!