ggplotify sequence plots (updated slides)
![]()
Goals:
Tasks:
| Summarization plots | TraMineR functions | ggseqplot function | ggplot2 function |
|---|---|---|---|
| State Distribution Plot | ggseqdplot |
geom_bar |
|
| Entropy Line Plot | ggseqeplot |
geom_line |
|
| Modal State Sequence Plot | ggseqmsplot |
geom_bar |
|
| Mean Time Plot | ggseqmtplot |
geom_bar |
|
| Transition Rate Plot | seqtrate |
ggseqtrplot |
geom_tile |
| Representation plots | TraMineR functions | ggseqplot functions | ggplot2 and related functions |
|---|---|---|---|
| Sequence Index Plot | seqiplot |
ggseqiplot |
|
| Sequence Frequency Plot | seqfplot |
|
|
| Representative Sequence Plot |
|
||
| Relative Frequency Sequence Plot | seqrfplot |
|
We use the well-known example data from {TraMineR} to render some plots.
ggseqdplot(actcal.seq,
border = TRUE) +
# Built-in months abbreviations for axis labels
scale_x_discrete(labels = month.abb) +
# change the color palette (fill and border color)
scale_fill_discrete_sequential("heat") +
# apply & adjust alternative theme
theme_ipsum() +
theme(
legend.position = "bottom",
legend.title = element_blank(),
legend.text = element_text(size = 11)
)
ggseqiplot(actcal.seq, sortv = "from.end") +
# Use months abbreviations for axis labels
scale_x_discrete(labels = month.abb) +
# change the fill and border color
scale_fill_discrete_sequential("heat") +
scale_color_discrete_sequential("heat") +
# add a title and a axis title
labs(x = "Month",
title = "Piccarreta-flavored Index Plot") +
# let the time run "bottom-up" instead of "left-right"
coord_flip() +
# Change the position and size
# of the title and the legend position
theme(legend.position = "top",
plot.title = element_text(size = 30),
plot.title.position = "plot")
Warning
Important
Warning
Important

Marcel Raab | SAA Webinar Series | September 2023