[Traminer-users] change order of states in seqdplot but keep colors assigned to each state the same

Haapakorva Pasi pasi.haapakorva at thl.fi
Mon Aug 1 08:17:55 CEST 2016


Hi

You can retrieve the color palette and work from there. The order of states can be adjusted with the alphabet parameter.

colors <- attr(mvad.seq, "cpal")
> colors
[1] "#7FC97F" "#BEAED4" "#FDC086" "#FFFF99" "#386CB0" "#F0027F"

mvad.alphabet <- c("HE", "joblessness", "school", "FE", "training", "employment")
mvad.labels <- c("higher education", "joblessness", "school", "further education", "training", "employment")
mvad.seq <- seqdef(mvad, 15:86, labels = mvad.labels, alphabet = mvad.alphabet, cpal = colors[c(3,4,5,2,6,1)], xtstep = 6)
seqdplot(mvad.seq, border = NA)


Pasi Haapakorva

From: traminer-users-bounces at r-forge.wu-wien.ac.at [mailto:traminer-users-bounces at r-forge.wu-wien.ac.at] On Behalf Of Jeremy Reynolds
Sent: 20. heinäkuuta 2016 19:31
To: traminer-users at lists.r-forge.r-project.org
Subject: [Traminer-users] change order of states in seqdplot but keep colors assigned to each state the same

Hi All,
I have created a plot using seqdplot using the default color scheme called "Accent."
I would like to change the order in which the states are plotted but keep the colors assigned to each state the same.
In the example below, for instance, how could I have "employment" stay green but have it plotted at the top of the graph and have "further education" remain purple  but have it plotted between the red and blue states.

data(mvad)
mvad.labels <- c("employment", "further education", "higher education", "joblessness", "school", "training")
mvad.seq <- seqdef(mvad, 15:86, labels = mvad.labels, xtstep = 6)
seqdplot(mvad.seq, border = NA)
I know that changing the order of the states in the variables used to make the sequence object will change the order in which they are plotted, so that is a good start, but I am not sure how to keep the color associated with each state the same after the re-ordering.  Perhaps the solution is to create a custom color palette with the same colors as the "Accent" color palette, but I cannot seem to figure out the names of the colors used in that palette.

Any tips would be appreciated.
Thanks,
Jeremy





--
********************
Dr. Jeremy Reynolds
Professor
Department of Sociology
116 Baldwin Hall
University of Georgia
Athens, GA 30602-1611
Phone: (706) 583-8072
Web: http://uga.edu/soc/people/faculty/reynolds_jeremy.php
Fax: (706) 542-4320
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20160801/94350dd6/attachment.html>


More information about the Traminer-users mailing list