The library indeed makes plotting easier, assuming some familiarity with ggplot2
functions (just like TraMineR
's plot functions require some knowledge of base R's plot
environment if you want to modify them). In this case, you need to know how to change the appearance of axis scales and that the position scale of the sequences - usually indicating time points - is conceived as a discrete scale. Hence, you need to use the function scale_x_discrete()
to adjust the axis.
library(ggseqplot)
# Create a sequence object from the mvad data set
data(mvad)
mvad.seq <- seqdef(mvad[,17:86])
# Plot the sequence object: dplot with desired break points
ggseqdplot(mvad.seq) +
scale_x_discrete(breaks = c(1, seq(10,70,10)))
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
![](https://cdn.statically.io/img/i.imgur.com/Rafkuj5.png)
# ... add own labels
ggseqdplot(mvad.seq) +
scale_x_discrete(breaks = c(1, seq(10,70,10)),
labels = paste0("y", c(1, seq(10,70,10))))
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
![](https://cdn.statically.io/img/i.imgur.com/BZrV1RS.png)
Created on 2023-11-30 with reprex v2.0.2
ggplot
functions like in other settings: so checkscale_x_continuous
orscale_x_date
(depending on your data), check thebreaks
argument.