I used to use TraMineR function seqfplot() with argument yaxis = "pct", which nicely put the percentage value for each sequence on the y-axis. Somewhere along the way some update of the package lost that feature somehow (I am on version 2.2-7 now), and an error is thrown.
library(TraMineR) # version 2.2-7
data from example in ?seqplot:
data(actcal)
set.seed(1)
actcal <- actcal[sample(nrow(actcal),300),]
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal,13:24,labels=actcal.lab)
simple plot, but not with the y-axis annotiation I want (the percentage value for each sequence should be displayed):
seqfplot(actcal.seq)
this used to work in earlier versions of TraMineR, these days it throws an Error: If not logical, yaxis should be one of "all" or "left"
seqfplot(actcal.seq, yaxis = "pct")
when using ?plot.stslist.freq directly, it does what seqfplot used to do:
x <- seqtab(actcal.seq)
plot(x, yaxis = "pct")
But this doesn't have all the sophisticated features of seqfplot (like allowing grouping and automatic display of the state color legend). The problem seems to be that argument yaxis is used in both seqfplot() and in plot.stslist.freq(), but in different ways, and so cannot be passed through.
Can I somehow get seqfplot(actcal.seq, yaxis = "pct") to work as it used to?
Sounds like a bug after one of the recent TraMineR updates. I am confident that the excellent TraMineR team will fix the issue once they are aware of it (either due to your question or a direct message).
In the meantime, I'd like to point you to an alternative package for plotting sequence data, I wrote because I am usually using ggplot2 instead of base R plot. Maybe, that's an interesting option for you as well.
Created on 2023-05-04 with reprex v2.0.2