You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/ggseqdplot.R
+64-10Lines changed: 64 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,18 @@
7
7
#'
8
8
#' @eval shared_params()
9
9
#' @param no.n specifies if number of (weighted) sequences is shown (default is \code{TRUE})
10
+
#' @param dissect if \code{"row"} or \code{"col"} are specified separate distribution plots instead of a stacked plot are displayed;
11
+
#' \code{"row"} and \code{"col"} display the distributions in one row or one column respectively; default is \code{NULL}
10
12
#' @param with.missing Specifies if missing states should be considered when computing the state distributions (default is \code{FALSE}).
11
13
#' @param border if \code{TRUE} bars are plotted with black outline; default is \code{FALSE} (also accepts \code{NULL})
12
14
#' @param with.entropy add line plot of cross-sectional entropies at each sequence position
13
15
#' @param linetype The linetype for the entropy subplot (\code{with.entropy==TRUE}) can be specified with an integer (0-6) or name (0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash); ; default is \code{"dashed"}
14
16
#' @param linecolor Specifies the color of the entropy line if \code{with.entropy==TRUE}; default is \code{"black"}
15
17
#' @param linewidth Specifies the width of the entropy line if \code{with.entropy==TRUE}; default is \code{1}
16
18
#' @eval shared_facet()
19
+
#' @param ... if group is specified additional arguments of \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap}}
20
+
#' such as \code{"labeller"} or \code{"strip.position"} can be used to change the appearance of the plot. Does
21
+
#' not work if \code{dissect} is used
17
22
#'
18
23
#' @return A sequence distribution plot created by using \code{\link[ggplot2]{ggplot2}}.
19
24
#' If stored as object the resulting list object (of class gg and ggplot) also
@@ -27,11 +32,12 @@
27
32
#' decades (see \insertCite{blossfeld1987;textual}{ggseqplot} for an early application),
28
33
#' it should be noted that the size of the different bars in stacked bar charts
29
34
#' might be difficult to compare - particularly if the alphabet comprises many
30
-
#' states \insertCite{wilke2019}{ggseqplot}. Moreover, it is important to keep
31
-
#' in mind that this plot type does not visualize individual trajectories;
32
-
#' instead it displays aggregated distributional information (repeated cross-sections).
33
-
#' For a more detailed discussion of this type of sequence visualization see,
34
-
#' for example, \insertCite{brzinsky-fay2014;textual}{ggseqplot},
35
+
#' states \insertCite{wilke2019}{ggseqplot}. This issue can be addressed by breaking down
36
+
#' the aggregated distribution specifying the \code{dissect} argument. Moreover, it
37
+
#' is important to keep in mind that this plot type does not visualize individual
38
+
#' trajectories; instead it displays aggregated distributional information
39
+
#' (repeated cross-sections). For a more detailed discussion of this type of
40
+
#' sequence visualization see, for example, \insertCite{brzinsky-fay2014;textual}{ggseqplot},
35
41
#' \insertCite{fasang2014;textual}{ggseqplot}, and \insertCite{raab2022;textual}{ggseqplot}.
36
42
#'
37
43
#' The function uses \code{\link[TraMineR:seqstatd]{TraMineR::seqstatd}} to obtain state
@@ -40,8 +46,12 @@
40
46
#' the \code{\link[TraMineR:seqdef]{TraMineR::seqdef}} function. The state distributions
41
47
#' are reshaped into a a long data format to enable plotting with \code{\link[ggplot2]{ggplot2}}.
42
48
#' The stacked bars are rendered by calling \code{\link[ggplot2]{geom_bar}}; if \code{entropy = TRUE}
43
-
#' entropy values are plotted with \code{\link[ggplot2]{geom_line}}. The data
44
-
#' and specifications used for rendering the plot can be obtained by storing the
49
+
#' entropy values are plotted with \code{\link[ggplot2]{geom_line}}. If the \code{group} or the
50
+
#' \code{dissect} argument are specified the sub-plots are produced by using
51
+
#' \code{\link[ggplot2]{facet_wrap}}. If both are specified the plots are rendered with
52
+
#' \code{\link[ggplot2]{facet_grid}}.
53
+
#'
54
+
#' The data and specifications used for rendering the plot can be obtained by storing the
45
55
#' plot as an object. The appearance of the plot can be adjusted just like with
46
56
#' every other ggplot (e.g., by changing the theme or the scale using \code{+} and
0 commit comments